Firefox downloads opens PDF in LibreOffice

Solution 1:

I managed to fix it with kde system settings. Go to File Associations, there find pdf Application preference order. It has Okular in the top, so I first put it down, so that LibreOffice in the top, and clicked Apply. Then I placed the Okular back to the top and applied again. Now firefox picked it up.