Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically select text area and autofill from clipboard #804

Draft
wants to merge 3 commits into
base: master
from

Conversation

@thec0mpler
Copy link
Contributor

thec0mpler commented Jan 12, 2020

Fixes #798.

I'm not sure if setting the text after opening the dialog is error proof and a clean way. Let me know what you think?

Copy link
Member

vktr left a comment

Awesome work 😃 I've left a few requested changes, otherwise it looks good!

@@ -67,6 +67,9 @@ void TorrentTrackersWidget::onAddTracker()
dlg->setWindowTitle(i18n("add_tracker"));
dlg->open();

QClipboard* clipboard = QGuiApplication::clipboard();
dlg->setText(clipboard->text());

This comment has been minimized.

Copy link
@vktr

vktr Jan 19, 2020

Member

Perhaps we should be a bit restrictive here? Perhaps check if the string looks like a URL - ie. starts with http(s) or udp?

@@ -669,6 +670,15 @@ void MainWindow::onFileAddMagnetLinks()
dlg->setWindowTitle(i18n("add_magnet_link_s"));
dlg->open();

QClipboard* clipboard = QApplication::clipboard();
QString text = clipboard->text();
if (clipboard->text().startsWith(

This comment has been minimized.

Copy link
@vktr

vktr Jan 19, 2020

Member

Use the already available text variable and put the if statement on a single line.

this->setFocusToText();
}


This comment has been minimized.

Copy link
@vktr

vktr Jan 19, 2020

Member

One empty line too many

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.