mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
[searchengine] Detect new plugin URL from clipboard
This commit is contained in:
parent
fc65ba4ced
commit
6a1497de92
1 changed files with 9 additions and 1 deletions
|
@ -46,6 +46,7 @@
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QClipboard>
|
||||||
|
|
||||||
enum EngineColumns {ENGINE_NAME, ENGINE_VERSION, ENGINE_URL, ENGINE_STATE, ENGINE_ID};
|
enum EngineColumns {ENGINE_NAME, ENGINE_VERSION, ENGINE_URL, ENGINE_STATE, ENGINE_ID};
|
||||||
|
|
||||||
|
@ -351,9 +352,16 @@ void engineSelectDlg::on_installButton_clicked() {
|
||||||
|
|
||||||
void engineSelectDlg::askForPluginUrl() {
|
void engineSelectDlg::askForPluginUrl() {
|
||||||
bool ok(false);
|
bool ok(false);
|
||||||
|
QString clipTxt = qApp->clipboard()->text();
|
||||||
|
QString defaultUrl = "http://";
|
||||||
|
if ((clipTxt.startsWith("http://", Qt::CaseInsensitive)
|
||||||
|
|| clipTxt.startsWith("https://", Qt::CaseInsensitive)
|
||||||
|
|| clipTxt.startsWith("ftp://", Qt::CaseInsensitive))
|
||||||
|
&& clipTxt.endsWith(".py"))
|
||||||
|
defaultUrl = clipTxt;
|
||||||
QString url = AutoExpandableDialog::getText(this, tr("New search engine plugin URL"),
|
QString url = AutoExpandableDialog::getText(this, tr("New search engine plugin URL"),
|
||||||
tr("URL:"), QLineEdit::Normal,
|
tr("URL:"), QLineEdit::Normal,
|
||||||
"http://", &ok);
|
defaultUrl, &ok);
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
if (!ok || url.isEmpty())
|
if (!ok || url.isEmpty())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue