lolo101/MsgViewer

Set RTF/Text via parameter

Closed this issue ยท 16 comments

The option "RTF/Text" should be adjustable via parameter, e.g. : -text
If this parameter is not set, "RTF" is default, if possible.

Hi @mik0001 and thank you for your suggestion

However, could you be more specific? Are you talking about the possibility to converting a message that has an RTF body to a plain text message?

Yes. I just want to have the Radiofield "Text" on the bottom of the frame as default on program-start with a given msg-file, when parameter "-text" is additionally set.

Yes, that is possible to do. Could you tell me what is your use case?

I don't think it is worth adding a new CL option just to save a click. Hence I suppose you have a more constrained use case and I need to understand it to help you best.

Good morning lolo101,

let me explain that!
mik0001 is a colleque of mine. We are a small company providing ERP solutions for our customers. Our customers are used to highly customized software and so they have sometimes strange wishes :-)

In this case we're starting the msgviewer right from the command line with a msg-File. That works just fine but now the customers wants the Text Version to display at startup, not the RTF Version (I have no idea why...).

This isn't a big problem for us to just put in a new parameter setting the default start view. We can do that in our ERP system and if you like I can do that in the msgviewer code and provide a PR for you. Would that work for you? Any better ideas?

Thomas

Oh, I see there is some kind of config parameter for that?
image
I'll check that!

I think that will work for us. Adding the following:
image
to file:
C:\Users\tchristlieb\MSGViewer\MSGViewer.properties
does the trick!

I'm pretty sure we can add that to our application.

Okay, there is still a problem with the config file - it's only on a per user base.
If you have a system with many users that won't cut it.

So we need to add a start parameter or do you have a better idea?

Hi @ThomasChr and thank you very much for the explanation ๐Ÿ™‚

I'm very honored to see MsgViewer used in a professional context.

I think this feature hardly deserves a command line switch and I'd rather implement a fallback system from the local config to a global config. I'll look into this.

Meanwhile, if you need this feature quickly you can of course implement it and propose a PR, I'd gladly consider it

Hi @lolo101 - I tried to add the startup parameter. I think this is the nicest way to do that, providing the startup args in the root class. I couldn't follow the approach the other parameters take because I can't access the BaseModule Class (with the checking for the startup parameters) from the later classes. What do you think?
master...ThomasChr:MsgViewer:startupPara

This is an ad-hoc development. You don't need to bother with isYes and map(s->"yes"). You may just do something like

boolean rtfFormat = StringUtils.isYes(root.getSetup().getLocalConfig("RTFFormat", "yes"))
        && Stream.of(root.getStartupArgs()).noneMatch(isEqualTo(CLI_STARTUP_TEXT_VIEW));

That would be a very acceptable workaround waiting for a global config

Is it ok for you?

Absolutely!
I will code the PR tomorrow!
Thanks for your help!

I'm not very good at patience, so here's the PR :-)
But -by all means- take your time. We're not in a rush and I'm glad you're helping that much!

It's merged ๐Ÿ‘

Thanks a lot!
Should we close this Issue or leave it open?

Let's close it as your PR solves the problem stated. I'll open a new one to improve the configuration

Would be glad to help with the new one if I can!