Esempio n. 1
0
    void GUI::openTorrent()
    {
        QString filter = kt::TorrentFileFilter(true);
        KUrl::List urls = KFileDialog::getOpenUrls(KUrl("kfiledialog:///openTorrent"), filter, this, i18n("Open Location"));

        if (urls.count() == 0)
            return;
        else if (urls.count() == 1)
        {
            KUrl url = urls.front();
            if (url.isValid())
                load(url);
        }
        else
        {
            // load multiple torrents silently
            foreach (const KUrl& url, urls)
            {
                if (url.isValid())
                {
                    if (Settings::openMultipleTorrentsSilently())
                        loadSilently(url);
                    else
                        load(url);
                }
            }
        }
    }
static QString urls2string( const KUrl::List & urls ) {
    return urls.empty() ? QString() : urls.front().url() ;
}