[Kget] Paste from clipboard - multiple links

Kolik Software koliksoftware at gmail.com
Mon Mar 17 20:24:22 CET 2008


Hello, I was wondering whether there would be any support to pasting
multiple links from clipboard, such as:

http://www.somelink.xx/file.rar1
http://www.somelink.xx/file.rar2
http://www.somelink.xx/file.rar3

At some forums, such multiple links are listed in plain text targeting
a big file split into multiple rars. In such cases, I would have to
select each by one and copy to KGet. I was hoping that in a new Kde4
KGet this would be supported, but it wasn't. Even it didn't support
importing text files.

As I have never found this to be listed on some todo list, I made it
myself, however, it would be nice to have it in an official branch and
also to extend the idea (e.g. I would appreciate having a "Copy from
clipboard" button in a KGet's systray popup menu instead of having
Auto Paste mode selected which causes problems when I copy urls I
don't want to download - links to a blog, for example).

I'm new here and in Linux, so I don't know your development processes.
So I'm gonna paste my code here, just for inspiration and hope some of
you gurus will do something about it.

I apologize if this has been discussed before already.

This is how I modified a "slotCheckClipboard" method in
mainwindow.cpp. It would though need some more error checking.

void MainWindow::slotCheckClipboard()
{
    QString clipData =
QApplication::clipboard()->text(QClipboard::Clipboard).trimmed();

    if (clipData != lastClipboard)
    {
        lastClipboard = clipData;
        if (lastClipboard.isEmpty())
            return;

	QStringList list = lastClipboard.split(QRegExp("[\r\n]"));
	KUrl::List urlList = KUrl::List(list);	
	KGet::addTransfer(urlList);
    }
}

Regards,
Kolik


More information about the Kget mailing list