2f9e50805e23d1d8a9eb21eaefa930e94004274f
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / pinentry / 0002-qt-no-accessibility.patch
1 commit 484465338ea6f5f12eb1341ca0ef84aa79224ed4
2 Author: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
3 Date:   Mon Dec 8 16:42:42 2014 +0000
4
5     pinentry-qt4: make the accessibility part optional
6     
7     Check if the Qt libraries have support for QT Accessibility before using
8     it. Otherwise it will raise error like these one:
9     
10     main.cpp: In function 'int qt_cmd_handler(pinentry_t)':
11     main.cpp:220:51: error: 'class QAbstractButton' has no member named
12     'setAccessibleDescription'
13     
14     Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
15
16 Backported from upstream.
17
18 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
19
20 diff --git a/qt4/main.cpp b/qt4/main.cpp
21 index 106999e..b2a69f2 100644
22 --- a/qt4/main.cpp
23 +++ b/qt4/main.cpp
24 @@ -217,8 +217,9 @@ qt_cmd_handler (pinentry_t pe)
25        for ( size_t i = 0 ; i < sizeof buttonLabels / sizeof *buttonLabels ; ++i )
26          if ( (buttons & buttonLabels[i].button) && !buttonLabels[i].label.isEmpty() ) {
27              box.button( buttonLabels[i].button )->setText( buttonLabels[i].label );
28 +#ifndef QT_NO_ACCESSIBILITY
29              box.button( buttonLabels[i].button )->setAccessibleDescription ( buttonLabels[i].label );
30 -
31 +#endif
32          }
33  
34        box.setIconPixmap( icon() );
35 diff --git a/qt4/pinentryconfirm.cpp b/qt4/pinentryconfirm.cpp
36 index dfbd19f..6b3d545 100644
37 --- a/qt4/pinentryconfirm.cpp
38 +++ b/qt4/pinentryconfirm.cpp
39 @@ -30,8 +30,10 @@ PinentryConfirm::PinentryConfirm(Icon icon, int timeout, const QString &title,
40         connect(_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
41         _timer->start(timeout*1000);
42      }
43 +#ifndef QT_NO_ACCESSIBILITY
44      setAccessibleDescription (desc);
45      setAccessibleName (title);
46 +#endif
47      raiseWindow (this);
48  }
49  
50 diff --git a/qt4/pinentrydialog.cpp b/qt4/pinentrydialog.cpp
51 index 3a6dacc..456f022 100644
52 --- a/qt4/pinentrydialog.cpp
53 +++ b/qt4/pinentrydialog.cpp
54 @@ -217,7 +217,9 @@ void PinEntryDialog::setDescription( const QString& txt )
55  {
56    _desc->setVisible( !txt.isEmpty() );
57    _desc->setText( txt );
58 +#ifndef QT_NO_ACCESSIBILITY
59    _desc->setAccessibleDescription ( txt );
60 +#endif
61    _icon->setPixmap( icon() );
62    setError( QString::null );
63  }
64 @@ -231,7 +233,9 @@ void PinEntryDialog::setError( const QString& txt )
65  {
66    if( !txt.isNull() )_icon->setPixmap( icon( QStyle::SP_MessageBoxCritical ) );
67    _error->setText( txt );
68 +#ifndef QT_NO_ACCESSIBILITY
69    _error->setAccessibleDescription ( txt );
70 +#endif
71    _error->setVisible( !txt.isEmpty() );
72  }
73  
74 @@ -264,14 +268,18 @@ QString PinEntryDialog::prompt() const
75  void PinEntryDialog::setOkText( const QString& txt )
76  {
77    _ok->setText( txt );
78 +#ifndef QT_NO_ACCESSIBILITY
79    _ok->setAccessibleDescription ( txt );
80 +#endif
81    _ok->setVisible( !txt.isEmpty() );
82  }
83  
84  void PinEntryDialog::setCancelText( const QString& txt )
85  {
86    _cancel->setText( txt );
87 +#ifndef QT_NO_ACCESSIBILITY
88    _cancel->setAccessibleDescription ( txt );
89 +#endif
90    _cancel->setVisible( !txt.isEmpty() );
91  }
92  
93 @@ -279,7 +287,9 @@ void PinEntryDialog::setQualityBar( const QString& txt )
94  {
95    if (_have_quality_bar) {
96      _quality_bar_label->setText( txt );
97 +#ifndef QT_NO_ACCESSIBILITY
98      _quality_bar_label->setAccessibleDescription ( txt );
99 +#endif
100    }
101  }
102