How should be the SetValidData method used

Support for developers of new plugins, third-party plugin announcements and discussions.
manison
Plugin Developer
Plugin Developer
Posts: 216
Joined: 09 Dec 2005, 23:23
Location: Ceske Budejovice, Czech Republic
Contact:

How should be the SetValidData method used

Post by manison »

How is the CSalamanderDirectoryAbstract::SetValidData method expected to be used? Should it be called before each AddDir/AddFile or just once before the first AddDir/AddFile? I would like to selectively filter out invalid file dates/times so I set the validity mask to contain VALID_DATA_PL_DATE and VALID_DATA_PL_TIME. In this case the GetLastWriteDate/GetLastWriteTime methods on my CPluginFSDataInterface are called, what's correct I suppose. But even if I return TRUE from those methods the date/time is not displayed and the date/time columns don't appear at all. If I don't change the default validity mask (don't call the SetValidData method), the GetLastWriteDate/Time methods are not invoked, date/time columns are displayed but may contain invalid times (e.g. when the FILETIME is zero, 1. 1. 1601 is displayed in date column). Any suggestions?
Petr Solin
ALTAP Staff
ALTAP Staff
Posts: 1112
Joined: 08 Dec 2005, 09:13
Location: Novy Bor, Czech Republic
Contact:

Post by Petr Solin »

CSalamanderDirectoryAbstract::SetValidData method should be called only once at the beginning.

I understand your problem, I had to solve it in FTP too (some listings do not contain dates and/or times for some files/dirs). Unfortunatelly the currently possible solution is not so simple as you expected (it would solve only one date&time column, but we needed to support also more date&time columns, e.g. "modified", "created", "accessed").

The solution is to add your own columns (see how to do it in DEMOPLUG plugin) for dates and times. It enables you to show empty values anywhere you need (for invalid dates/times). Then you should set VALID_DATA_PL_DATE and VALID_DATA_PL_TIME in CSalamanderDirectoryAbstract::SetValidData method. And implement GetLastWriteDate/GetLastWriteTime methods. These methods are used in Tiles mode in panels, in Make File List and Compare Directories commands, and during panel refresh (when copying icons from old listing to new listing).

Unpleasant thing is that sorting on these added columns is not supported yet, I have it on my to-do list, but I have no idea when I finish it.
manison
Plugin Developer
Plugin Developer
Posts: 216
Joined: 09 Dec 2005, 23:23
Location: Ceske Budejovice, Czech Republic
Contact:

Post by manison »

Oh Petr, thanks for detailed explanation. I think I can live with invalid dates for some time, since there is more important (and less complicated) work to do yet :)
Post Reply