Index: setup/ConnectionSetting.cc =================================================================== --- setup.orig/ConnectionSetting.cc +++ setup/ConnectionSetting.cc @@ -26,27 +26,50 @@ static const char *cvsid = #include "resource.h" #include "String++.h" +#include "getopt++/BoolOption.h" +#include "getopt++/StringOption.h" + +static BoolOption UseIE5(false, 'E', "use-ie5", "Use IE5 connection settings"); +static StringOption ProxyHost( "" , 'H', "proxy-name", "Name of proxy to use in download", false ); +static StringOption ProxyPort( "" , 'P', "proxy-port", "Proxy port to use in download", false ); + void ConnectionSetting::load() { static int inited = 0; if (inited) return; - io_stream *f = UserSettings::Instance().settingFileForLoad("last-connection"); - if (f) + + if (UseIE5 || (((std::string) ProxyHost).size())) { - char localdir[1000]; - char *fg_ret = f->gets (localdir, 1000); - if (fg_ret) - NetIO::net_method = typeFromString(fg_ret); - fg_ret = f->gets (localdir, 1000); - if (fg_ret) - NetIO::net_proxy_host = strdup(fg_ret); - fg_ret = f->gets (localdir, 1000); - if (fg_ret) - NetIO::net_proxy_port = atoi(fg_ret); - delete f; + NetIO::net_method = typeFromString(""); + + if (((std::string)ProxyHost).size()) + { + NetIO::net_proxy_host = strdup(((std::string)ProxyHost).c_str()); + NetIO::net_proxy_port = (((std::string)ProxyPort).size())? + atoi(((std::string)ProxyPort).c_str()) : + 80; + } } + else + { + io_stream *f = UserSettings::Instance().settingFileForLoad("last-connection"); + if (f) + { + char localdir[1000]; + char *fg_ret = f->gets (localdir, 1000); + if (fg_ret) + NetIO::net_method = typeFromString(fg_ret); + fg_ret = f->gets (localdir, 1000); + if (fg_ret) + NetIO::net_proxy_host = strdup(fg_ret); + fg_ret = f->gets (localdir, 1000); + if (fg_ret) + NetIO::net_proxy_port = atoi(fg_ret); + delete f; + } + } inited = 1; } @@ -54,7 +77,7 @@ void ConnectionSetting::save() { char port_str[20]; - + io_stream *f = UserSettings::Instance().settingFileForSave("last-connection"); if (f) { @@ -81,6 +104,10 @@ ConnectionSetting::save() int ConnectionSetting::typeFromString(const std::string& aType) { + if (UseIE5) + return IDC_NET_IE5; + if (((std::string)ProxyHost).size()) + return IDC_NET_PROXY; if (!casecompare(aType, "Direct")) return IDC_NET_DIRECT; if (!casecompare(aType, "IE")) Index: setup/PickCategoryLine.h =================================================================== --- setup.orig/PickCategoryLine.h +++ setup/PickCategoryLine.h @@ -25,12 +25,18 @@ class PickView; class PickCategoryLine:public PickLine { public: - PickCategoryLine (PickView & aView, Category & _cat, size_t thedepth = 0, bool aBool = - true, bool aBool2 = - true):PickLine (_cat.first), - current_default (packagemeta::Default_action), cat (_cat), labellength (0), + PickCategoryLine ( + PickView & aView, + Category & _cat, + packagemeta::_actions _current_default = packagemeta::Default_action, + size_t thedepth = 0, + bool aBool = true, + bool aBool2 = true) : + + PickLine (_cat.first), cat (_cat), labellength (0), depth (thedepth), theView (aView) { + current_default = _current_default; if (aBool) { collapsed = true; @@ -41,6 +47,7 @@ public: collapsed = false; show_label = aBool2; } + set_action(current_default); }; ~PickCategoryLine () { Index: setup/PickView.cc =================================================================== --- setup.orig/PickView.cc +++ setup/PickView.cc @@ -182,7 +182,7 @@ PickView::setViewMode (views mode) (pkg.desired && (pkg.desired.picked () || // install bin pkg.desired.sourcePackage ().picked ())))) // src - + // "Up to date" : installed packages that will not be changed || (view_mode == PickView::views::PackageKeeps && (pkg.installed && pkg.desired && !pkg.desired.picked () @@ -191,7 +191,7 @@ PickView::setViewMode (views mode) // "Not installed" || (view_mode == PickView::views::PackageSkips && (!pkg.desired && !pkg.installed))) - + insert_pkg (pkg); } } @@ -213,6 +213,12 @@ PickView::setViewMode (views mode) scroll_ulc_x = scroll_ulc_y = 0; InvalidateRect (GetHWND(), &r, TRUE); + + if (packagemeta::action_from_argv() != packagemeta::Default_action) + { + packagedb().markUnVisited(); + contents.set_action(packagemeta::action_from_argv()); + } } const char * @@ -246,7 +252,7 @@ bool isObsolete (set &categories) { set ::const_iterator i; - + for (i = categories.begin (); i != categories.end (); ++i) if (isObsolete (*i)) return true; @@ -256,7 +262,7 @@ isObsolete (set first, "All") == 0 || (!showObsolete && isObsolete (cat->first))) return; - PickCategoryLine & catline = *new PickCategoryLine (*this, *cat, 1, collapsed); + PickCategoryLine & catline = *new PickCategoryLine(*this, *cat, + packagemeta::action_from_argv(), 1, collapsed); + for (vector ::iterator i = cat->second.begin (); i != cat->second.end () ; ++i) { @@ -425,7 +434,7 @@ PickView::init_headers (HDC dc) // conversion by the unwise String(int) constructor. note_width (headers, dc, "0", HMARGIN + 11, bintick_col); note_width (headers, dc, "0", HMARGIN + 11, srctick_col); - + // accomodate the width of each category name packagedb db; for (packagedb::categoriesType::iterator n = packagedb::categories.begin(); @@ -465,14 +474,14 @@ PickView::init_headers (HDC dc) if (pkg.SDesc ().size()) s += std::string (": ") + std::string(pkg.SDesc ()); note_width (headers, dc, s, HMARGIN, pkg_col); - + if (view_mode != PickView::views::Category && pkg.categories.size () > 2) { - std::string compound_cat(""); + std::string compound_cat(""); std::set::const_iterator cat; size_t cnt; - - for (cnt = 0, cat = pkg.categories.begin (); + + for (cnt = 0, cat = pkg.categories.begin (); cnt < NUM_CATEGORY_COL_WIDTH && cat != pkg.categories.end (); ++cat) { @@ -486,9 +495,9 @@ PickView::init_headers (HDC dc) note_width (headers, dc, compound_cat, HMARGIN, cat_col); } } - + // ensure that the new_col is wide enough for all the labels - const char *captions[] = { "Uninstall", "Skip", "Reinstall", "Retrieve", + const char *captions[] = { "Uninstall", "Skip", "Reinstall", "Retrieve", "Source", "Keep", NULL }; for (int i = 0; captions[i]; i++) note_width (headers, dc, captions[i], HMARGIN + SPIN_WIDTH, new_col); @@ -501,8 +510,8 @@ PickView::init_headers (HDC dc) PickView::PickView (Category &cat) : deftrust (TRUST_UNKNOWN), -contents (*this, cat, 0, false, true), showObsolete (false), -hasClientRect (false) +contents (*this, cat, packagemeta::action_from_argv(), false, true), +showObsolete (false), hasClientRect (false) { } @@ -521,8 +530,8 @@ PickView::init(views _mode) bm_checkno = LI (IDB_CHECK_NO); bm_checkna = LI (IDB_CHECK_NA); bm_treeplus = LI (IDB_TREE_PLUS); - bm_treeminus = LI (IDB_TREE_MINUS); -#undef LI + bm_treeminus = LI (IDB_TREE_MINUS); +#undef LI icon_dc = CreateCompatibleDC (dc); bm_icon = CreateCompatibleBitmap (dc, 11, 11); SelectObject (icon_dc, bm_icon); @@ -538,7 +547,7 @@ PickView::init(views _mode) // Ensure that the common control DLL is loaded, and then create // the header control. - INITCOMMONCONTROLSEX controlinfo = { sizeof (INITCOMMONCONTROLSEX), + INITCOMMONCONTROLSEX controlinfo = { sizeof (INITCOMMONCONTROLSEX), ICC_LISTVIEW_CLASSES }; InitCommonControlsEx (&controlinfo); @@ -717,7 +726,7 @@ PickView::WindowProc (UINT message, WPAR { int wheel_notches; UINT wheel_lines; - + switch (message) { case WM_HSCROLL: @@ -729,7 +738,7 @@ PickView::WindowProc (UINT message, WPAR case WM_MOUSEWHEEL: // this is how many 'notches' the wheel scrolled, forward/up = positive wheel_notches = GET_WHEEL_DELTA_WPARAM(wParam) / 120; - + // determine how many lines the user has configred for a mouse scroll SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheel_lines, 0); @@ -759,21 +768,21 @@ PickView::WindowProc (UINT message, WPAR { if (phdr->pitem && phdr->pitem->mask & HDI_WIDTH) headers[phdr->iItem].width = phdr->pitem->cxy; - + for (int i = 1; i <= last_col; i++) headers[i].x = headers[i - 1].x + headers[i - 1].width; - + RECT r = GetClientRect (); SCROLLINFO si; si.cbSize = sizeof (si); si.fMask = SIF_ALL | SIF_DISABLENOSCROLL; GetScrollInfo (GetHWND(), SB_HORZ, &si); - + int oldMax = si.nMax; si.nMax = headers[last_col].x + headers[last_col].width; if (si.nTrackPos && oldMax > si.nMax) si.nTrackPos += si.nMax - oldMax; - + si.nPage = r.right; SetScrollInfo (GetHWND(), SB_HORZ, &si, TRUE); InvalidateRect (GetHWND(), &r, TRUE); @@ -803,12 +812,12 @@ PickView::WindowProc (UINT message, WPAR } else hasClientRect = true; - + lastClientRect = clientRect; - return 0; + return 0; } } - + // default: can't handle this message return DefWindowProc (GetHWND(), message, wParam, lParam); } @@ -855,7 +864,7 @@ PickView::paint (HWND hwnd) // painting, it will retrigger us so that we can fix it PAINTSTRUCT ps; HDC hdc = BeginPaint (hwnd, &ps); - + SelectObject (hdc, sysfont); SetTextColor (hdc, GetSysColor (COLOR_WINDOWTEXT)); SetBkColor (hdc, GetSysColor (COLOR_WINDOW)); @@ -871,7 +880,7 @@ PickView::paint (HWND hwnd) int x = cr.left - scroll_ulc_x; int y = cr.top - scroll_ulc_y + header_height; - contents.paint (hdc, hUpdRgn, x, y, 0, (view_mode == + contents.paint (hdc, hUpdRgn, x, y, 0, (view_mode == PickView::views::Category) ? 0 : 1); if (contents.itemcount () == 0) @@ -888,7 +897,7 @@ PickView::paint (HWND hwnd) } -bool +bool PickView::Create (Window * parent, DWORD Style, RECT *r) { @@ -947,7 +956,7 @@ PickView::defaultTrust (trusts trust) { pkg.desired = pkg.trustp (trust); if (pkg.desired) - pkg.desired.pick (pkg.desired.accessible() && + pkg.desired.pick (pkg.desired.accessible() && pkg.desired != pkg.installed); } else @@ -970,7 +979,7 @@ void PickView::refresh() { HDC dc = GetDC (GetHWND ()); - + // we must set the font of the DC here, otherwise the width calculations // will be off because the system will use the wrong font metrics sysfont = GetStockObject (DEFAULT_GUI_FONT); @@ -979,12 +988,12 @@ PickView::refresh() // init headers for the current mode set_headers (); init_headers (dc); - + // save the current mode views cur_view_mode = view_mode; - + // switch to the other type and do those headers - view_mode = (view_mode == PickView::views::Category) ? + view_mode = (view_mode == PickView::views::Category) ? PickView::views::PackageFull : PickView::views::Category; set_headers (); init_headers (dc); Index: setup/net.cc =================================================================== --- setup.orig/net.cc +++ setup/net.cc @@ -136,12 +136,12 @@ NetPage::OnInit () CheckIfEnableNext(); // Check to see if any radio buttons are selected. If not, select a default. - if ((!SendMessage (GetDlgItem (IDC_NET_IE5), BM_GETCHECK, 0, 0) == + if ((!SendMessage (GetDlgItem (IDC_NET_DIRECT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (!SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0) == BST_CHECKED)) { - SendMessage (GetDlgItem (IDC_NET_DIRECT), BM_CLICK, 0, 0); + SendMessage (GetDlgItem (IDC_NET_IE5), BM_CLICK, 0, 0); } } Index: setup/package_meta.cc =================================================================== --- setup.orig/package_meta.cc +++ setup/package_meta.cc @@ -28,6 +28,7 @@ using namespace std; #include #include #include "getopt++/StringOption.h" +#include "getopt++/BoolOption.h" #include "io_stream.h" #include "compress.h" @@ -51,6 +52,10 @@ using namespace std; using namespace std; +static BoolOption AllInstall ( false, 'a', "all-install", "install it all"); +static BoolOption UnInstall ( false, 'u', "un-install", "un-install it all"); +static BoolOption ReInstall ( false, 'e', "re-install", "re-Install it all"); + /*****************/ const @@ -66,6 +71,18 @@ const packagemeta::_actions packagemeta::Uninstall_action (3); +packagemeta::_actions packagemeta::action_from_argv() +{ + + return + ( + (AllInstall)? packagemeta::Install_action : + (UnInstall)? packagemeta::Uninstall_action : + (ReInstall)? packagemeta::Reinstall_action : + packagemeta::Default_action + ); +} + char const * packagemeta::_actions::caption () { Index: setup/package_meta.h =================================================================== --- setup.orig/package_meta.h +++ setup/package_meta.h @@ -24,6 +24,7 @@ class category; #include #include "PackageTrust.h" #include "package_version.h" +#include typedef std::pair > Category; @@ -39,6 +40,7 @@ public: { } + void _printcanon(); packagemeta (const std::string& pkgname, const std::string& installedfrom):name (pkgname), key(pkgname), installed_from (installedfrom), @@ -56,6 +58,8 @@ public: bool hasNoCategories() const; void setDefaultCategories(); void addToCategoryAll(); + void addToCategoryBase(); + bool isManuallyWanted() const; class _actions { @@ -66,17 +70,22 @@ public: if (_value < 0 || _value > 3) _value = 0; } + +// _actions & operator= (int val); _actions & operator ++ (); bool operator == (_actions const &rhs) { return _value == rhs._value; } bool operator != (_actions const &rhs) { return _value != rhs._value; } + const char *caption (); private: int _value; }; + static const _actions Default_action; static const _actions Install_action; static const _actions Reinstall_action; static const _actions Uninstall_action; + static _actions action_from_argv(); void set_action (packageversion const &default_version); void set_action (_actions, packageversion const & default_version); void uninstall (); @@ -142,6 +151,7 @@ public: void logSelectionStatus() const; void logAllVersions() const; + protected: packagemeta &operator= (packagemeta const &); private: