~ubuntu-branches/ubuntu/lucid/mythtv/lucid

« back to all changes in this revision

Viewing changes to libs/libmythui/mythuiwebbrowser.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Dave Walker (Daviey), Jamie Bennett, Mario Limonciello, Dave Walker (Daviey)
  • Date: 2010-03-23 19:32:33 UTC
  • mfrom: (1.1.49 upstream)
  • Revision ID: james.westby@ubuntu.com-20100323193233-5sv9djoxtlmwt3ca
Tags: 0.23.0+fixes23789-0ubuntu1
[ Jamie Bennett ]
* Fix FTBFS on armel (LP: #537714)

[ Mario Limonciello ]
* mythtv-{common,backend}.{config,templates,postinst}: (LP: #483748)
  - Simplify debconf questions by avoiding showing the generated pw
  - Don't warn about mythtv group.
  - Don't notify about running mythtv-setup.  This is optional (but
    of course encouraged!)
* Set version to include a "+" delimitter.
* Restore libfaad-dev dependency. (LP: #546552)

[ Dave Walker (Daviey) ]
* New snapshot (r23789), based from 0.23-fixes.
* debian/control:
  - mythtv-frontend set to Conflict with mythflix, as it's dropped
    upstream. (LP: #544521)
  - Remove unnecessary and potentially problematic use of Pre-Depends.
  - Set the debug package to Priority extra.
  - Change *-perl Section's from libs to perl
  - add ${shlibs:Depends} for mythtv-common Depends field
  - Minor spelling fix.
  - Fixes the long description for one of the packages, ensuring the
    description doesn't exceed 80 characters.
  - Vcs-* set to -fixes, rather than -trunk.
* debian/rules:
  - Use debconf-updatepo to update translations when required
  - Ensure license files are not included in the binary packages, except 
    for debian/copyright.
  - Fixes the permissions of certain files in the packaging.
* debian/copyright:
  - updated to reflect that mythtv is GPL-2 only.
  - inserted better licence statement and Copyright reference.
* debian/mythtv-*.templates
  - Simplified strings; removed verbosity and improved readability.
* Prevent the maintainer scripts from failing in case any questions 
  can't be displayed.
* Added holding debian/mythtv-frontend.config, mainly to appease lintian.
* debian/mythtv-frontend.menu: Changed section to Applications/Graphics.
* debian/mythtv-backend.postinst: Load debconf libraries.
* debian/source.lintian-overrides: Removes the unecessary override of the 
  binNMU warnings.
* Fix perl binding installation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
void MythWebView::keyPressEvent(QKeyEvent *event)
50
50
{
51
 
    if (m_parentBrowser && !m_parentBrowser->keyPressEvent(event))
 
51
    // if the QWebView widget has focus then all keypresses from a regular keyboard 
 
52
    // get sent here first
 
53
    if (m_parentBrowser && m_parentBrowser->IsInputToggled())
 
54
    {
 
55
        // input is toggled so pass all keypresses to the QWebView's handler
52
56
        QWebView::keyPressEvent(event);
 
57
    }
 
58
    else
 
59
    {
 
60
        // we need to convert a few keypress events so the QWebView does the right thing
 
61
        QStringList actions;
 
62
        bool handled = false;
 
63
        handled = GetMythMainWindow()->TranslateKeyPress("Browser", event, actions);
 
64
 
 
65
        for (int i = 0; i < actions.size() && !handled; i++)
 
66
        {
 
67
            QString action = actions[i];
 
68
            handled = true;
 
69
            if (action == "NEXTLINK")
 
70
            {
 
71
                QKeyEvent tabKey(event->type(), Qt::Key_Tab,
 
72
                                 event->modifiers(), QString(),
 
73
                                 event->isAutoRepeat(), event->count());
 
74
                *event = tabKey;
 
75
                QWebView::keyPressEvent(event);
 
76
                return;
 
77
            }
 
78
            else if (action == "PREVIOUSLINK")
 
79
            {
 
80
                QKeyEvent shiftTabKey(event->type(), Qt::Key_Tab,
 
81
                                      event->modifiers() | Qt::ShiftModifier,QString(),
 
82
                                      event->isAutoRepeat(), event->count());
 
83
                *event = shiftTabKey;
 
84
                QWebView::keyPressEvent(event);
 
85
                return;
 
86
            }
 
87
            else if (action == "FOLLOWLINK")
 
88
            {
 
89
                QKeyEvent returnKey(event->type(), Qt::Key_Return,
 
90
                                    event->modifiers(), QString(),
 
91
                                    event->isAutoRepeat(), event->count());
 
92
                *event = returnKey;
 
93
                QWebView::keyPressEvent(event);
 
94
                return;
 
95
            }
 
96
        }
 
97
 
 
98
        // pass the keyPress event to our main window handler so they get handled properly
 
99
        // by the various mythui handlers
 
100
        QCoreApplication::postEvent(GetMythMainWindow(), new QKeyEvent(*event));
 
101
    }
53
102
}
54
103
 
55
104
void MythWebView::handleUnsupportedContent(QNetworkReply *reply)
149
198
      m_image(NULL),         m_active(false),
150
199
      m_initialized(false),  m_lastUpdateTime(QTime()),
151
200
      m_updateInterval(0),   m_zoom(1.0),
152
 
      m_bgColor("White"),    m_widgetUrl(QUrl()),
 
201
      m_bgColor("White"),    m_widgetUrl(QUrl()), m_userCssFile(""),
153
202
      m_inputToggled(false), m_lastMouseAction(""),
154
203
      m_mouseKeyCount(0),    m_lastMouseActionTime()
155
204
{
180
229
    m_browser->move(m_Area.x(), m_Area.y());
181
230
    m_browser->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
182
231
 
 
232
    // if we have a valid css URL use that ...
 
233
    if (!m_userCssFile.isEmpty())
 
234
    {
 
235
        QString filename = m_userCssFile;
 
236
        if (GetMythUI()->FindThemeFile(filename))
 
237
            LoadUserStyleSheet(QUrl("file://" + filename));
 
238
    }
 
239
    else
 
240
    {
 
241
        // ...otherwise use the default one
 
242
        QString filename = "htmls/mythbrowser.css";
 
243
        if (GetMythUI()->FindThemeFile(filename))
 
244
            LoadUserStyleSheet(QUrl("file://" + filename));
 
245
    }
 
246
 
183
247
    m_browser->winId();
184
248
 
185
249
    SetActive(m_active);
277
341
    m_browser->setHtml(html, baseUrl);
278
342
}
279
343
 
 
344
/** \fn MythUIWebBrowser::LoadUserStyleSheet(QUrl)
 
345
 *  \brief Sets the specified user style sheet.
 
346
 *  \param url The url to the style sheet
 
347
 */
 
348
void MythUIWebBrowser::LoadUserStyleSheet(QUrl url)
 
349
{
 
350
    if (!m_browser)
 
351
        return;
 
352
 
 
353
    VERBOSE(VB_IMPORTANT, "MythUIWebBrowser: Loading css from - " + url.toString());
 
354
 
 
355
    m_browser->page()->settings()->setUserStyleSheetUrl(url);
 
356
}
 
357
 
280
358
/** \fn MythUIWebBrowser::SetBackgroundColor(QColor)
281
359
 *  \brief Sets the default background color.
282
360
 *  \param color the color to use
565
643
 
566
644
        if (action == "TOGGLEINPUT")
567
645
        {
568
 
#if 0
569
 
            if (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1)
570
 
            {
571
 
                if (inputToggled)
572
 
                    return true;
573
 
 
574
 
                inputToggled = true;
575
 
                VirtualKeyboard *keyboard = new VirtualKeyboard(
576
 
                    gContext->GetMainWindow(), m_browser);
577
 
                gContext->GetMainWindow()->detach(keyboard);
578
 
                keyboard->exec();
579
 
                keyboard->deleteLater();
580
 
 
581
 
                inputToggled = false;
582
 
            }
583
 
            else
584
 
            {
585
 
                m_inputToggled = !m_inputToggled;
586
 
            }
587
 
 
 
646
            m_inputToggled = !m_inputToggled;
588
647
            return true;
589
 
#endif
590
648
        }
591
649
 
592
650
        // if input is toggled all input goes to the web page
593
651
        if (m_inputToggled)
594
 
            return false;
 
652
        {
 
653
            m_browser->keyPressEvent(event);
 
654
            return true;
 
655
        }
595
656
 
596
657
        if (action == "UP")
597
658
        {
695
756
        }
696
757
        else if (action == "NEXTLINK")
697
758
        {
698
 
            QKeyEvent tabKey(event->type(), Qt::Key_Tab,
699
 
                             event->modifiers(), QString(),
700
 
                             event->isAutoRepeat(), event->count());
701
 
 
702
 
            *event = tabKey;
703
 
 
704
 
            return false;
705
 
 
 
759
            m_browser->keyPressEvent(event);
706
760
        }
707
761
        else if (action == "PREVIOUSLINK")
708
762
        {
709
 
            QKeyEvent shiftTabKey(event->type(), Qt::Key_Tab,
710
 
                          event->modifiers() | Qt::ShiftModifier,QString(),
711
 
                          event->isAutoRepeat(), event->count());
712
 
 
713
 
            *event = shiftTabKey;
714
 
 
715
 
            return false;
 
763
            m_browser->keyPressEvent(event);
716
764
        }
717
765
        else if (action == "FOLLOWLINK")
718
766
        {
719
 
            QKeyEvent returnKey(event->type(), Qt::Key_Return,
720
 
                                event->modifiers(), QString(),
721
 
                                event->isAutoRepeat(), event->count());
722
 
            *event = returnKey;
723
 
 
724
 
            return false;
 
767
            m_browser->keyPressEvent(event);
725
768
        }
726
769
        else if (action == "HISTORYBACK")
727
770
        {
810
853
    {
811
854
        m_widgetUrl.setUrl(getFirstText(element));
812
855
    }
 
856
    else if (element.tagName() == "userstylesheet")
 
857
    {
 
858
        m_userCssFile = getFirstText(element);
 
859
    }
813
860
    else if (element.tagName() == "updateinterval")
814
861
    {
815
862
        QString interval = getFirstText(element);
843
890
    m_zoom = browser->m_zoom;
844
891
    m_bgColor = browser->m_bgColor;
845
892
    m_widgetUrl = browser->m_widgetUrl;
 
893
    m_userCssFile = browser->m_userCssFile;
846
894
    m_updateInterval = browser->m_updateInterval;
847
895
 
848
896
    Init();