There are jeans, and then there are jeans.
The OP's outfit sounds like it was up the "smarter" end of the jeans scale. So therefore, I don't think she was terribly wrong for wearing them to a viewing. Yes, a formal suit would have been ideal, but really, a nice pair of jeans, top and jacket isn't horrendously rude (to me anyway).
As for her friend, if: (a) she wasn't at the viewing and didn't know the deceased; and (b) offered her opinion to the OP unasked, then I do think she was rude.