Changeset View
Changeset View
Standalone View
Standalone View
executebrowserplugin.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
61 | 61 | | |||
62 | void ExecuteBrowserPlugin::unload() | 62 | void ExecuteBrowserPlugin::unload() | ||
63 | { | 63 | { | ||
64 | } | 64 | } | ||
65 | 65 | | |||
66 | QUrl ExecuteBrowserPlugin::url( KDevelop::ILaunchConfiguration* cfg, QString& err_ ) const | 66 | QUrl ExecuteBrowserPlugin::url( KDevelop::ILaunchConfiguration* cfg, QString& err_ ) const | ||
67 | { | 67 | { | ||
68 | QUrl url; | 68 | QUrl url; | ||
69 | | ||||
70 | if( !cfg ) | 69 | if( !cfg ) | ||
71 | { | 70 | { | ||
72 | return url; | 71 | return url; | ||
73 | } | 72 | } | ||
74 | KConfigGroup grp = cfg->config(); | 73 | KConfigGroup grp = cfg->config(); | ||
75 | 74 | | |||
76 | QString host = grp.readEntry( ExecuteBrowserPlugin::serverEntry, "" ); | 75 | QString host = grp.readEntry( ExecuteBrowserPlugin::serverEntry, "" ); | ||
77 | if( host.isEmpty() ) | 76 | if( host.isEmpty() ) | ||
78 | { | 77 | { | ||
79 | err_ = i18n("No valid server specified"); | 78 | err_ = i18n("Empty server in launch configuration"); | ||
80 | qCWarning(KDEV_EXECUTEBROWSER) << "Launch Configuration:" << cfg->name() << "no valid server specified"; | 79 | qCWarning(KDEV_EXECUTEBROWSER) << "Launch Configuration:" << cfg->name() << err_; | ||
81 | return url; | 80 | return url; | ||
82 | } | 81 | } | ||
83 | url.setScheme("http"); | 82 | | ||
84 | url.setHost(host); | 83 | QString path(grp.readEntry( ExecuteBrowserPlugin::pathEntry, "" )); | ||
85 | url.setPath(grp.readEntry( ExecuteBrowserPlugin::pathEntry, "" )); | 84 | if( !host.endsWith("/") && !path.isEmpty() && !path.startsWith("/") ) { | ||
86 | { | 85 | host += "/"; | ||
86 | } | ||||
87 | url.setUrl(host + path); | ||||
apol: Looks like something will be missing now, at least it won't be very backwards compatible. For… | |||||
Yes, that was something odd with the old code. It added manually a fixed scheme part with url.setScheme("http"); so i guess you could not use https:// for your project. Now, I assume the schema part is part of the host. Maybe we could change the label in the .ui I wonder if with the old code you could open a url like "https://kde.org/index.html", I bet that you could''t. santilin: Yes, that was something odd with the old code. It added manually a fixed scheme part with url. | |||||
Probably not. Now if we need to go this way, it would probably make sense to use a different configuration setting, otherwise people will get weird URLs. apol: Probably not. Now if we need to go this way, it would probably make sense to use a different… | |||||
What about if( !host.contains(QStringLiteral("://")) ) { host.prepend(QStringLiteral("http://")); } zhigalin: What about
```
if( !host.contains(QStringLiteral("://")) )
{
host.prepend(QStringLiteral… | |||||
87 | QString q = grp.readEntry( ExecuteBrowserPlugin::argumentsEntry, "" ); | 88 | QString q = grp.readEntry( ExecuteBrowserPlugin::argumentsEntry, "" ); | ||
88 | if (!q.isEmpty()) { | 89 | if (!q.isEmpty()) { | ||
89 | url.setQuery(q); | 90 | url.setQuery(q); | ||
90 | } | 91 | } | ||
92 | if( url.toString().isEmpty() ) { | ||||
93 | err_ = i18n("Invalid launch configuration"); | ||||
94 | qCWarning(KDEV_EXECUTEBROWSER) << "Launch Configuration:" << cfg->name() << err_; | ||||
95 | return url; | ||||
91 | } | 96 | } | ||
97 | qCDebug(KDEV_EXECUTEBROWSER) << "Url:" << url.toString(); | ||||
92 | return url; | 98 | return url; | ||
93 | } | 99 | } | ||
94 | 100 | | |||
95 | QString ExecuteBrowserPlugin::browser( ILaunchConfiguration* cfg ) const | 101 | QString ExecuteBrowserPlugin::browser( ILaunchConfiguration* cfg ) const | ||
96 | { | 102 | { | ||
97 | return cfg->config().readEntry( ExecuteBrowserPlugin::browserEntry, "" ); | 103 | return cfg->config().readEntry( ExecuteBrowserPlugin::browserEntry, "" ); | ||
98 | } | 104 | } | ||
99 | 105 | | |||
100 | QString ExecuteBrowserPlugin::browserAppConfigTypeId() const | 106 | QString ExecuteBrowserPlugin::browserAppConfigTypeId() const | ||
101 | { | 107 | { | ||
102 | return _browserAppConfigTypeId; | 108 | return _browserAppConfigTypeId; | ||
103 | } | 109 | } | ||
104 | 110 | | |||
105 | 111 | | |||
106 | #include "executebrowserplugin.moc" | 112 | #include "executebrowserplugin.moc" |
Looks like something will be missing now, at least it won't be very backwards compatible. For "https://kde.org/index.html" the host used to be "kde.org", now you are assuming that the schema is part of the host? Should we change the serverEntry definition to be the base url rather than the hostname?