Bail out MainWindow::newConnection() if we don't have a plugin for the requested URL

Ignore the return value from showDialogIfNeeded(). Since we're already there, the user made quite clear that he wants to see the view, either by passing it via the command line or typing it into the new connection bar.

Testing Done

Invoke:
$ krdc rdp://<your.favorite.rdp.host>

Without the 1. patch krdc converts the URL to vnc:// as seen in the windowTitle.
With the 1. patch, but without the 2., the RDP connection is opened, but the view is closed instantly by MainWindow::saveHostPrefs(), leaving the user with a new connection tab.
With both patches krdc works as expected.

Screenshots

Files

Issues

6

2

0

All Issues:8

Description

From

Last Updated

QUrl::fromUserInput() is what you should use when the input is user-supplied like here.

Hmm, as Thiago pointed out correctly in response to my patches on the kde-devel-Mailinglist, it's not QUrl's fault in the first patch.
The patch works, but it's not 100% correct. QUrl::fromLocalFile(arg) should simply be QUrl(arg). rdp://<host> is not a local file, but since we said so, we get file://rdp://<host>

So we could do something like this (pseudo code):
foreach (commandline arg){
QUrl url(arg);
if(url.scheme() is in (supported schemes))
addConnection(url)

Should I prepare a new patchset and a new review request or a follow-up patch?

Don't treat an URL passwd via the command line as a local file. That gives us file://rdp://<something or other>, which is garbage.

~

Don't shut down the view when the user chose not to show the preference dialog for the host

~

Also don't close the view on MainWindow::saveHostPrefs()

-

The second patch prevents the newly opened RdpView from being closed after app.exec(). app.exec() calls MainWindow::saveHostPrefs(), which closes the just created view. I have no idea why that is necessary. Removing the call to view->startQuitting() survived all tests.

-

-

Also, I don't understand why we need to destroy the view in MainWindow::newConnection() if the user chose not to see the preferences for the host. Just show the dialog, or not...

Without the 1. patch, krdc converts every URL to vnc://
With the 1. patch, but without the 2., the view is closed immediately if the user chose not to see the preferences for the host passed via the command line
The 3. patch prevents the view from being closed when MainWindow::saveHostPrefs() is called. That makes no sense. That slot is called right after app.exec(), so the view is created, but instantly closed after startup.
The 4. patch implements your suggestions.

Change Summary:

Description:

Don't treat an URL passwd via the command line as a local file. That gives us file://rdp://<something or other>, which is garbage.

~

Don't shut down the view when the user chose not to show the preference dialog for the host

~

Also don't close the view on MainWindow::saveHostPrefs()

~

Use QUrl::fromUserInput() for parsing command line arguments

~

Bail out MainWindow::newConnection() if we don't have a plugin for the requested URL

~

Ignore the return value from showDialogIfNeeded(). Since we're already there, the user made quite clear that he wants to see the view, either by passing it via the command line or typing it into the new connection bar.