void BookmarkManager::slotShowMarked(void)
{
    if (GetMarkedCount() == 0)
        return;

    MythUIButtonListItem *item = m_bookmarkList->GetItemCurrent();
    if (item && item->GetData().isValid())
    {
       Bookmark *site = qVariantValue<Bookmark*>(item->GetData());
       m_savedBookmark = *site;
    }

    QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal");
    QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0");
    QStringList urls;

    for (int x = 0; x < m_siteList.size(); x++)
    {
        Bookmark *site = m_siteList.at(x);
        if (site && site->selected)
            urls.append(site->url);
    }

    if (cmd.toLower() == "internal")
    {
        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();

        MythBrowser *mythbrowser = new MythBrowser(mainStack, urls);

        if (mythbrowser->Create())
        {
            connect(mythbrowser, SIGNAL(Exiting()), SLOT(slotBrowserClosed()));
            mainStack->AddScreen(mythbrowser);
        }
        else
            delete mythbrowser;
    }
    else
    {
        cmd.replace("%ZOOM%", zoom);
        cmd.replace("%URL%", urls.join(" "));

        cmd.replace("&","\\&");
        cmd.replace(";","\\;");

        GetMythMainWindow()->AllowInput(false);
        myth_system(cmd, kMSDontDisableDrawing);
        GetMythMainWindow()->AllowInput(true);

        // we need to reload the bookmarks incase the user added/deleted
        // any while in MythBrowser
        ReloadBookmarks();
    }
}
Beispiel #2
0
static int handleMedia(const QString &url, const QString &directory, const QString &filename,
                       const QString &, const QString &, int, int, const QString &, int,
                       const QString &, const QString &, bool)
{
    if (url.isEmpty())
    {
        LOG(VB_GENERAL, LOG_ERR, "MythBrowser: handleMedia got empty url!");
        return 1;
    }

    QStringList urls = url.split(" ", QString::SkipEmptyParts);
    float zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0").toFloat();

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();

    if (urls[0].startsWith("mythflash://"))
    {
        MythFlashPlayer *flashplayer = new MythFlashPlayer(mainStack, urls);
        if (flashplayer->Create())
            mainStack->AddScreen(flashplayer);
        else
            delete flashplayer;
    }
    else
    {
        MythBrowser *mythbrowser = new MythBrowser(mainStack, urls, zoom);

        if (!directory.isEmpty())
            mythbrowser->setDefaultSaveDirectory(directory);

        if (!filename.isEmpty())
            mythbrowser->setDefaultSaveFilename(filename);

        if (mythbrowser->Create())
            mainStack->AddScreen(mythbrowser);
        else
            delete mythbrowser;
    }

    return 0;
}