Jon Turney [Wed, 20 Mar 2019 19:56:44 +0000 (19:56 +0000)]
Add double-click for a 'default action' to ListView
Add support for a double-click in the ListView to invoke a 'default
action'.
Because we receive both NM_CLICK and then NM_DBCLK, reduce the area of a
pop-up column which is sensitive to a click to the drop-down button
(which opens a focus-stealing pop-up menu), so the rest of the area can
receive a click (which does nothing) or a double-click (which does the
default action).
For a package, this default action is to toggle between the currently
installed version (or uninstalled, if not installed), and the highest
non-test version.
There is no keyboard acceleration for this action currently.
Jon Turney [Wed, 20 Mar 2019 18:08:23 +0000 (18:08 +0000)]
Don't propagate actions down category tree into obsolete categories
Choosing the 'Install' action on the 'All' category shouldn't propagate
down into the '_obsolete' category, because that will just result in
dependency conflicts due to trying to install both obsolete packages and
their replacements.
Jon Turney [Wed, 20 Mar 2019 17:12:08 +0000 (17:12 +0000)]
Don't show FTP 550 'file not found' errors in a MessageBox
Don't show FTP 550 'file not found' errors in a MessageBox. Also log
InternetGetLastResponseInfo() when fetching a URL.
WinInet documentation seems to indicate this kind of extended error
information only exists when WinInet has an FTP error code to report.
Log this error (and the associated URL) rather than just showing a
MessageBox. Don't bother showing a MessageBox for 550, since we can
tolerate certain missing files (e.g. setup.zst), and we'll go on to
report that couldn't fetch needed files in a more generic way.
Jon Turney [Sat, 21 Jul 2018 21:19:51 +0000 (22:19 +0100)]
Simple keyboard accelerators for Listview
Wire-up certain actions to keyboard accelerators.
To permit selecting a subitem apparently needs us to custom-draw everything,
so for simplicity, just make the accelerators per row.
Getting the enter keypress to be delivered to the listview is tricky (the
propsheet really want to hold onto it), so for the moment we just use the
Windows menu key and space bar as accelerators.
Ken Brown [Mon, 6 Aug 2018 14:05:12 +0000 (10:05 -0400)]
Ensure that an installed packageversion has an ldesc if possible
In packagedb::read(), copy the ldesc from setup.ini to the
packageversion read from installed.db. Otherwise, an installed
package with only one version will not have an ldesc to use as a
tooltip.
v2: If the installed version is no longer available, copy the ldesc
from the current version of the package.
Jon Turney [Tue, 17 Jul 2018 10:09:32 +0000 (11:09 +0100)]
Use indents in category view
We keep around an empty imagelist for 1x1 images, to reset the indent when
not in tree view mode
(This isn't quite right as the listview will allocate a 1-pixel space before
column 0 for those images, but this seems the best we can do as 0x0
imagelists aren't allowed...)
Jon Turney [Tue, 17 Jul 2018 18:26:23 +0000 (19:26 +0100)]
Use an icon to represent expanded/collapsed state
Use a listview icon to represent expanded/collapsed state, rather than
puttting '[+]'/'[-]' in front of the category name
Just use the item icon directly to represent expanded/collapsed state,
rather than using a state icon as otherwise we have empty space where the
item icon would be, when it's size is being used for indenting.
The icons were made by tracing the previously used .bmp in Inkscape to
produce a .svg, then converting that to an icon with ImageMagick using
'convert -filter point -background transparent -define icon:auto-resize'
Jon Turney [Wed, 7 Dec 2016 19:52:58 +0000 (19:52 +0000)]
Custom draw popup menus in ListView control
Construct a menu containing the actions from the action list for the package
or category, and if one is selected, apply it.
This lets us remove packagemeta::set_action() which implements the strange
UX of cycling around actions without showing what the possibilities are.
This somewhat emulates a BS_SPLITBUTTON style control. The 'popup' cell has
a visual hint that clicking on it opens a menu (a 'combox scrollbar'), and
the popup menu is located at the position of the click.
v2:
Factor out popup_menu, for future use by keyboard accelerators
Jon Turney [Thu, 8 Dec 2016 17:57:59 +0000 (17:57 +0000)]
Add methods for listing possible actions on, and applying one to, a package
The 'action id' is a value of the _actions enum, if positive, otherwise it's
absolute value is a 0-based index into the 'versions' collection to identify
a specific version to install.
Jon Turney [Wed, 7 Dec 2016 16:17:12 +0000 (16:17 +0000)]
Custom draw checkboxes in ListView control
Future work: What does this look like when a theme is in used? Does the row
size need to be slightly adjusted to ensure it accomodates checkbox height?
v2:
erase to background colour before drawing checkbox
Jon Turney [Wed, 7 Dec 2016 14:09:35 +0000 (14:09 +0000)]
Use a ListView common control rather than a hand-built grid
Each line is implemented by an object of a subclass of ListViewLine, either
PickPackageLine, or (in catgeory view) PickCategoryLine
v2:
Defer constructing category tree until packagedb is available
Also handle an empty category tree
Remove unused bitmaps
Scoping of strings returned to LVN_GETDISPINFO
Avoid doubled 'all' category
Update some number of lines, rather than just the current one
v3:
Speed up calculating column widths, by caching the DC used
Don't bother recalculating column widths when obsolete packages are
shown/hidden, just allow for obsolete packages always (which makes hardly
any difference)
Don't bother calculating column widths separately for category view since
they are now always the same.
v4:
Store current category action in CategoryTree
Recurse category action onto packages
This slightly changes the behaviour: previously, a category action only
effected packages which matched the name search filter. Now all packages in
contained by the category are effected.
v5:
When updating, turn off redraw before emptying listview
Make headers a parameter to init
Don't leak contents
Only resize columns once
Remove ListView OnMessage as it has nothing to do
Never use a column width less than minimum
Use LVS_SINGLESEL
Factor out string cache for re-use
Preserve focused row over ListView::setContents()
I think strlcat() was meant here, which MinGW doesn't have. In it's
absence, open-code it's equivalent.
(SHGetSpecialFolderLocation() returns a pathname of length at most MAX_PATH,
and make_link() is limited to accepting a pathname of length MAX_PATH, so we
want to append our folder name, while truncating the result to MAX_PATH.)
Fix message spam when package vendor is something other than "cygwin"
Installed packages are getting coerced to vendor "cygwin", so there will be
warnings if the vendor string of the single repo is something other than
that.
Jon Turney [Sat, 14 Jul 2018 15:46:57 +0000 (16:46 +0100)]
Initialize file_size in NetIO constructor
At the moment, this is not initialized anywhere. If it's value happens to
be greater than zero, that will be used as the size to report download
progress against.
Ken Brown [Sat, 17 Mar 2018 14:59:54 +0000 (10:59 -0400)]
Internalize the libsolv repo attribute data after each setup.ini
Call SolverPool::internalize() in the IniDBBuilderPackage destructor. This
makes attribute data from all previously processed setup.ini files available
when the next setup.ini is being processed.
Remove the now unneeded call to SolverPool::internalize() at the beginning
of packagedb::read().
Jon Turney [Sat, 7 Jul 2018 08:09:02 +0000 (09:09 +0100)]
Propagate exit code of elevated process
Propagate the exit code of elevated process, when --wait is used.
This addresses part of the problem about exit code noted in [1], although we
also need to audit that a non-zero exit code is reported in all error
situations.
Ken Brown [Wed, 21 Mar 2018 19:38:07 +0000 (15:38 -0400)]
Finish providing support for provides: and conflicts:
Introduce member functions SolvableVersion::provides() and
SolvableVersion::conflicts(). This enables packagedb::read() to access
provides and conflicts lists from setup.ini.
Corinna Vinschen [Mon, 18 Jun 2018 17:16:59 +0000 (19:16 +0200)]
netio.cc: fix a bug in string handling
commit ed6137e5f94f45e50a12994aeae310278b2bf758 back in 2003(!)
introduced a bug in creating an empty password string which,
embarrassingly, only now has been catched by gcc.
Ken Brown [Thu, 7 Jun 2018 17:37:24 +0000 (13:37 -0400)]
Fix detection of automatically added packages
In the "confirm" dialog, report a package as automatically added for install
if the version being installed is different from the version requested by
the user. This can happen if the global update mode is "Keep" but a package
needs to be updated because of a versioned dependency.
Ken Brown [Thu, 7 Jun 2018 17:37:23 +0000 (13:37 -0400)]
Improve the preparation of the package database
Introduce a new function packagedb::noChanges() to set the database to a "no
changes requested" state. Call it the first time the chooser page is
activated, before calling ChooserPage::applyCommandLinePackageSelection().
Also use it to simplify the code in two places.
Remove code from ChooserPage::changeTrust() that was making changes to the
database after ChooserPage::applyCommandLinePackageSelection() had already
been called.
Ken Brown [Sat, 17 Mar 2018 14:59:53 +0000 (10:59 -0400)]
Make sure that the IniDBBuilderPackage destructor is called when needed
The IniDBBuilderPackage destructor contains code that is intended to be run
after each setup.ini file is processed. But the IniDBBuilderPackage
variables in do_local_ini() and do_remote_ini were declared outside the loop
that processed the files. Move the declaration inside the loop so that the
destructor is called after each iteration.
Ken Brown [Wed, 21 Mar 2018 18:03:00 +0000 (14:03 -0400)]
Give a fatal error on a checksum failure during install
This only affects local installs, where the hash of an archive is not
checked until we reach do_install_thread(). At this point it seems
too late to recover safely.
Jon Turney [Tue, 6 Mar 2018 14:56:40 +0000 (14:56 +0000)]
Fix packagemeta::ScanDownloadedFiles
packagemeta::scan clears the site list if the package was not found, and
packagemeta::ScanDownloadedFiles uses packageversion::accessible() to check
that.
Instead communicate via a return value
v2:
empty packages were always inaccessible, even though we returned early from
scan() without clearing the sites list, so return false in that case
Jon Turney [Fri, 19 Jan 2018 15:36:03 +0000 (15:36 +0000)]
Add setup-minimum-version: to setup.ini
This allows setup.ini to require a certain setup version, rather than advise
a newer version when one is available.
Unfortunately, versions of setup prior to this one don't implement this, but
at least we have this going forward.
When we want to start using this, we can break backwards compatibility with
even older setup in a less clean way, simply by using setup.ini grammar that
they can't parse.
Jon Turney [Tue, 23 Jan 2018 17:50:13 +0000 (17:50 +0000)]
Add a new page to let the user review and confirm actions
Add a new page to let the user review and confirm actions, after
dependencies have been added and problems solved.
Ideally, this would re-use the picker-page grid to present these actions,
but for the moment just write it as text (as we did before in the prereq
page) (This is still a slight improvement as it shows all actions for
review, not just the ones added by the solver)
Jon Turney [Mon, 22 Jan 2018 22:33:54 +0000 (22:33 +0000)]
Add handling for 'replace-versions:' in setup.ini
Sometimes we make mistakes and release versions which are broken or have a
version which is wildly incorrect. We can remove those versions from future
download, but they can linger indefinitely in installs (until a distupgrade
is done), as there is a higher version already installed.
Allow setup.ini to contain a per-package 'replace-versions:' header, which
identifies any versions which should be forcibly dist-upgraded (i.e.
downgraded to the best version in setup.ini).
(It's not possible to just instruct the solver to disfavour these specific
versions, as that's not implemented, see libsolv issue #170)
Jon Turney [Fri, 19 Jan 2018 19:04:38 +0000 (19:04 +0000)]
Add 'depends2:' as an alternative to 'depends':
Prior versions of setup recognize 'depends:', but don't handle it properly:
(i) they always use the dependencies of the current version, not the version
actually being installed
(ii) they cannot parse any version-relation containing a relation and
version identifier (i.e. they can only handle a bare package name)
Thus, there is no safe way to start using 'depends:' lines without getting
undesirable behaviour from old versions of setup
(In case (i), it may install incorrect dependencies if a non-current version
is installed, potentially resulting in a broken package.
In case (ii), it will fail to parse the setup.ini with an error.)
Add 'depends2:', so calm can supply per-version dependencies in a form
useful to setup with libsolv-based dependency solving, without effecting
older versions of setup.
Jon Turney [Wed, 6 Dec 2017 17:52:45 +0000 (17:52 +0000)]
Apply default solution to dependency problems
Mark the default solution in the problem report
Refactor of SolverSolution::update() so we can apply the default
solution(s).
Also:
Break out logging of the task list, so we can show it in the "dependency
problems exists, but don't use the default solution, just do what I ask"
case.
Break out 'include-source' process, so it can have effect in the case where
dependency problems exist.
v2:
Actually re-solve after adjusting the task list with default solutions.
Use the last solution as the default solution. The solver sorts the
solutions, and I think the last one will normally be the one which removes
the problematic task from the task list
Jon Turney [Mon, 6 Nov 2017 18:02:08 +0000 (18:02 +0000)]
More crash avoidance in SolvableVersion member functions
The following call-stack means we end up calling SolvableVersion methods
before packagedb::prep(), i.e. before attributes have been internalized, so
their values aren't available.
Ken Brown [Sat, 28 Oct 2017 17:46:19 +0000 (13:46 -0400)]
Avoid clobbering installed.db when no setup.ini is found
If no setup.ini is found, do_ini_thread is never called. But we need to
ensure that packagedb::read is called, or else installed.db gets emptied.
Move the calls to packagedb::read and other packagedb functions from
do_ini_thread to ChooserPage::OnInit.