diff -upr setup/ConnectionSetting.cc setup.new/ConnectionSetting.cc --- setup/ConnectionSetting.cc 2003-10-26 04:02:52.000000000 -0800 +++ setup.new/ConnectionSetting.cc 2004-02-05 20:46:27.652250000 -0800 @@ -25,26 +25,49 @@ 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) - net_method = typeFromString(fg_ret); - fg_ret = f->gets (localdir, 1000); - if (fg_ret) - net_proxy_host = strdup(fg_ret); - fg_ret = f->gets (localdir, 1000); - if (fg_ret) - net_proxy_port = atoi(fg_ret); - delete f; + net_method = typeFromString(""); + + if (((std::string)ProxyHost).size()) + { + net_proxy_host = strdup(((std::string)ProxyHost).c_str()); + 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) + net_method = typeFromString(fg_ret); + fg_ret = f->gets (localdir, 1000); + if (fg_ret) + net_proxy_host = strdup(fg_ret); + fg_ret = f->gets (localdir, 1000); + if (fg_ret) + net_proxy_port = atoi(fg_ret); + delete f; + } } inited = 1; } @@ -80,6 +103,12 @@ ConnectionSetting::save() int ConnectionSetting::typeFromString(String const & aType) { + if (UseIE5) + return IDC_NET_IE5; + + if (((std::string)ProxyHost).size()) + return IDC_NET_PROXY; + if (!aType.casecompare("Direct")) return IDC_NET_DIRECT; if (!aType.casecompare("IE")) diff -upr setup/PickCategoryLine.h setup.new/PickCategoryLine.h --- setup/PickCategoryLine.h 2003-06-23 13:48:59.000000000 -0700 +++ setup.new/PickCategoryLine.h 2004-02-05 21:27:28.121000000 -0800 @@ -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 () { diff -upr setup/PickPackageLine.cc setup.new/PickPackageLine.cc --- setup/PickPackageLine.cc 2003-04-11 17:39:37.000000000 -0700 +++ setup.new/PickPackageLine.cc 2004-02-05 20:46:27.683500000 -0800 @@ -174,7 +174,7 @@ PickPackageLine::click (int const myrow, if (x >= theView.headers[theView.new_col].x - HMARGIN / 2 && x <= theView.headers[theView.new_col + 1].x - HMARGIN / 2) - pkg.set_action (pkg.trustp(theView.deftrust)); + pkg.set_action (pkg.trustp(theView.deftrust)); packagemeta::PrepareForVisit(); /* Add any packages that are needed by this package */ diff -upr setup/PickView.cc setup.new/PickView.cc --- setup/PickView.cc 2003-10-26 11:38:30.000000000 -0800 +++ setup.new/PickView.cc 2004-02-05 20:46:27.714750000 -0800 @@ -220,6 +220,12 @@ PickView::setViewMode (PickView::views m scroll_ulc_x = scroll_ulc_y = 0; InvalidateRect (GetHWND(), &r, TRUE); + + if (packagemeta::action_from_argv() != packagemeta::Default_action) + { + packagemeta::PrepareForVisit(); + contents.set_action(packagemeta::action_from_argv()); + } } const char * @@ -251,6 +257,7 @@ PickView::views::caption () void PickView::insert_pkg (packagemeta & pkg) { + if (view_mode != views::Category) { PickLine & line = *new PickPackageLine (*this, pkg); @@ -267,7 +274,9 @@ PickView::insert_pkg (packagemeta & pkg) continue; PickCategoryLine & catline = - *new PickCategoryLine (*this,* db.categories.find (*x), 1); + *new PickCategoryLine (*this,* db.categories.find (*x), + packagemeta::action_from_argv(), 1); + PickLine & line = *new PickPackageLine(*this, pkg); catline.insert (line); contents.insert (catline); @@ -281,7 +290,9 @@ PickView::insert_category (Category * ca // Urk, special case if (cat->first.casecompare ("All") == 0) 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) { @@ -440,7 +451,7 @@ PickView::init_headers (HDC dc) PickView::PickView (Category &cat) : deftrust (TRUST_UNKNOWN), -contents (*this, cat, 0, false, true), hasClientRect (false) +contents (*this, cat, packagemeta::action_from_argv(), false, true), hasClientRect (false) { } diff -upr setup/main.cc setup.new/main.cc --- setup/main.cc 2003-12-20 14:29:58.000000000 -0800 +++ setup.new/main.cc 2004-02-05 20:46:27.730375000 -0800 @@ -426,6 +426,25 @@ main (int argc, char **argv) local_dir = String (cwd); delete cwd; +// TODO: make an equivalent for __argv under cygwin. + char **_argv; +#ifndef __CYGWIN__ + int argc; +// char **_argv; +#ifndef __CYGWIN__ + for (argc = 0, _argv = __argv; *_argv; _argv++)++argc; + _argv = __argv; +#else +// for (argc = 0, _argv = argv; *_argv; _argv++)++argc; + _argv = argv; +#endif +#else + _argv = argv; +#endif + + if (!GetOption::GetInstance().Process (argc,_argv, NULL)) + theLog->exit(1); + LogSingleton::SetInstance (*(theLog = LogFile::createLogFile())); theLog->setFile (LOG_BABBLE, local_dir + "/setup.log.full", false); theLog->setFile (0, local_dir + "/setup.log", true); @@ -447,24 +466,6 @@ main (int argc, char **argv) log (LOG_TIMESTAMP) << "Current Directory: " << local_dir << endLog; - // TODO: make an equivalent for __argv under cygwin. - char **_argv; -#ifndef __CYGWIN__ - int argc; -// char **_argv; -#ifndef __CYGWIN__ - for (argc = 0, _argv = __argv; *_argv; _argv++)++argc; - _argv = __argv; -#else -// for (argc = 0, _argv = argv; *_argv; _argv++)++argc; - _argv = argv; -#endif -#else - _argv = argv; -#endif - - if (!GetOption::GetInstance().Process (argc,_argv, NULL)) - theLog->exit(1); // #endif if (HelpOption) diff -upr setup/net.cc setup.new/net.cc --- setup/net.cc 2003-07-30 03:41:43.000000000 -0700 +++ setup.new/net.cc 2004-02-05 20:46:27.746000000 -0800 @@ -102,12 +102,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); } } diff -upr setup/package_meta.cc setup.new/package_meta.cc --- setup/package_meta.cc 2003-07-28 01:32:07.000000000 -0700 +++ setup.new/package_meta.cc 2004-02-05 20:46:27.761625000 -0800 @@ -44,9 +44,14 @@ static const char *cvsid = "\n%%% $Id: p #include #include "Generic.h" +#include "getopt++/BoolOption.h" 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"); + static const char *standard_dirs[] = { "bin", "etc", @@ -111,6 +116,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 () { diff -upr setup/package_meta.h setup.new/package_meta.h --- setup/package_meta.h 2003-07-28 01:32:07.000000000 -0700 +++ setup.new/package_meta.h 2004-02-05 20:46:27.777250000 -0800 @@ -26,6 +26,7 @@ class category; #include "category.h" #include "PackageTrust.h" #include "package_version.h" +#include /* NOTE: A packagemeta without 1 packageversion is invalid! */ class packagemeta @@ -40,6 +41,7 @@ public: { } + void _printcanon(); packagemeta (String const &pkgname, String const &installedfrom):name (pkgname), key(pkgname), installed_from (installedfrom), @@ -61,23 +63,28 @@ public: class _actions { public: - _actions ():_value (0) {}; + _actions ():_value (0) {}; _actions (int aInt) { _value = aInt; 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 (); @@ -143,6 +150,7 @@ public: void logSelectionStatus() const; void logAllVersions() const; + protected: packagemeta &operator= (packagemeta const &); private: