> >> However, will implement this new idea, so that new channels are
> >> prefixed CHANNEL-.
>
> Michael> Please don't. No benefits from such a naming scheme that
> can't be solved
> Michael> better by checking for duplicates and showing an alert
> asking the user
> Michael> to confirm that the previous section should be
> overwritten. Could even
> Michael> prevent the user from using any of the "protected" names.
>
> But we need a way to decide if an section are an "plucker-desktop"
> section or not. Whats about the idea to add a new key "owner" and the
> section that contain this key with the value of "plucker-desktop" are
> displayed and modified by plucker-desktop.
>
> Then we need also an "reserved section list somewere" that never be
> used by plucker-desktop (or any other similar tool). Maybe an key
> "reserved_sections" in the Default section.
Hi Dirk,
This is the current relevant function of the configuration.cpp and
configuration.h, used for loading up the channel names into the listcontrol
on the main dialog:
(1) A list of non-channel section names in the ini is declared.
(2) Then we are looking through the remaining sections and if it has a key
of home_url, then it is a considered to be a channel. The reason for this is
that there can be "modifier sections" of the .ini which add can be combined
with an actual channel section at the command line (like the pluck-comics
examples).
Here is the code as current (note this is just reading, code for adding
hasn't been written yet):
#define NON_CHANNEL_SECTIONS "DEFAULT", "POSIX", "OS2" "WINDOWS",
"MACINTOSH", "PLUCKER-DESKTOP", "PLUCKER-DAEMON"
// Checks to see if it is a channel section of the config file, ie not one
// of [DEFAULT], [POSIX], [MACINTOSH], [PLUCKER-DESKTOP], etc.
bool is_channel_configuration_section( wxString section )
{
wxString key;
// Create a list of known non-channel strings. Need to call the last one as NULL.
// NON_CHANNEL_SECTIONS was defined in configuration.h
wxStringList *strings = new wxStringList( NON_CHANNEL_SECTIONS , NULL );
// Check to see whether the section passed is a member of the list of strings
// If is in list of non-channel sections, then isn't a channel section.
if ( strings->Member( section ) ) {
return FALSE;
} else {
// Now check to see that there is a home_url key in this section. If there
isn't,
// then it is just a modifier section (like "Sunday" in the comics examples).
key = section << '/' << "home_url";
if ( the_configuration->HasEntry( key ) ) {
return TRUE;
} else {
return FALSE;
}
}
}
Perhaps an avenue would be make the whole section naming thing invisible to the user,
ie never allow a rewrite overtop a current section of ini from within the GUI. We are
just generating a section name based on initial selection of a channel name (minus
spaces and illegal characters [and truncated at 31 characters at least on Mac]). If
they want to give their channel of Macintosh news, a channel name of 'Macintosh',
there wouldn't be a prompt come up saying they can't/ or warning them not to call it
Macintosh. Instead it just generates the section name of MACINTOSH_1 or something.
Ditto for a new channel name named 'Comics' when they already have a modifier section
named 'Comics'. Or if they want to maintain two copies of a distributable database,
one in color and one not in color, but still have the same channel name of 'My
Distributed Document' on both versions, the second added copy shouldn't force them to
pick another channel name, it should silently just make a relevant section name that
doesn't conflict with an existing one.
Note there is no UI element for changing the section name from within the Desktop
program, but this was by design--didn't seem that section names of config files are
something end users should be dealing with. Whether there should be or not is perhaps
a matter for discussion.
I was plan
ning on when pressing the 'Add Channel' on main dialog, it goes directly to
channel name dialog, the 'Channel Name' field is given the focus, and the
'Unnamed channel' text within the textbox is highlighted ready to be
replaced. On clicking 'OK' button, a legal, non-conflicting section name is
generated based on the value of channel name filed, and its subdirectory is
made and its section is added to the .ini file.
A more advanced way for expert users would be to ask in a popup-dialog what
they want the section/subdir to be called. Perhaps a 2 fielded dialog with
fields for channel name, and the section name. As type in the channel name
field, a legal section name gets added to that field letter by letter, then
can modify the section field before hitting OK. Then would have to prevent
naming of a protected section (or existing?), and prompt.
A checkbox in advanced section selects between the two.
Any other further modification needed? Easier if plan is sorted before the
add channel functionality is added.
Best wishes,
Robert