File pinentry-0.8.1-allow_paste_qt4.patch of Package pinentry
Index: pinentry-0.8.1/qt4/qsecurelineedit.h
===================================================================
--- pinentry-0.8.1.orig/qt4/qsecurelineedit.h 2009-04-15 10:05:17.000000000 +0200
+++ pinentry-0.8.1/qt4/qsecurelineedit.h 2011-09-14 11:33:50.310136644 +0200
@@ -61,15 +61,6 @@
#ifndef QT_NO_COMPLETER
# define QT_NO_COMPLETER
#endif
-#ifndef QT_NO_CLIPBOARD
-# define QT_NO_CLIPBOARD
-#endif
-#ifndef QT_NO_CONTEXTMENU
-# define QT_NO_CONTEXTMENU
-#endif
-#ifndef QT_NO_DRAGANDDROP
-# define QT_NO_DRAGANDDROP
-#endif
#ifndef QT_NO_STYLE_STYLESHEET
# define QT_NO_STYLE_STYLESHEET
#endif
Index: pinentry-0.8.1/qt4/secstring.cpp
===================================================================
--- pinentry-0.8.1.orig/qt4/secstring.cpp 2009-03-19 09:25:23.000000000 +0100
+++ pinentry-0.8.1/qt4/secstring.cpp 2011-09-14 11:32:02.609182285 +0200
@@ -102,3 +102,15 @@
return ba;
}
+QString sec_to_q(const secqstring& str)
+{
+ QString result (str.data());
+ return result;
+}
+
+secqstring q_to_sec (const QString& str)
+{
+ const QChar* p = str.constData();
+ secqstring result = p;
+ return result;
+}
Index: pinentry-0.8.1/qt4/secstring.h
===================================================================
--- pinentry-0.8.1.orig/qt4/secstring.h 2009-03-19 09:25:43.000000000 +0100
+++ pinentry-0.8.1/qt4/secstring.h 2011-09-14 11:30:35.561985760 +0200
@@ -34,6 +34,9 @@
secstring toUtf8( const secqstring & str );
+QString sec_to_q(const secqstring& str);
+secqstring q_to_sec (const QString& str);
+
Q_DECLARE_METATYPE( secqstring )
Q_DECLARE_METATYPE( secstring )
Index: pinentry-0.8.1/qt4/qsecurelineedit.cpp
===================================================================
--- pinentry-0.8.1.orig/qt4/qsecurelineedit.cpp 2009-04-15 10:05:17.000000000 +0200
+++ pinentry-0.8.1/qt4/qsecurelineedit.cpp 2011-09-14 12:01:27.974059276 +0200
@@ -1473,13 +1473,14 @@
clear();
d->resumePassword = true;
}
- insert(QApplication::clipboard()->text(QClipboard::Clipboard));
+ secqstring strForIns = q_to_sec(QApplication::clipboard()->text(QClipboard::Clipboard));
+ insert(strForIns);
}
void QSecureLineEditPrivate::copy(bool clipboard) const
{
Q_Q(const QSecureLineEdit);
- QString t = q->selectedText();
+ QString t = sec_to_q(q->selectedText());
if (!t.isEmpty() && echoMode == QSecureLineEdit::Normal) {
q->disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), q, 0);
QApplication::clipboard()->setText(t, clipboard ? QClipboard::Clipboard : QClipboard::Selection);
@@ -1699,7 +1700,7 @@
d->copy(false);
} else if (!d->readOnly && e->button() == Qt::MidButton) {
d->deselect();
- insert(QApplication::clipboard()->text(QClipboard::Selection));
+ insert(q_to_sec(QApplication::clipboard()->text(QClipboard::Selection)));
}
}
#endif
@@ -2503,7 +2504,7 @@
int oldSelEnd = d->selend;
d->cursorVisible = false;
e->acceptProposedAction();
- insert(str);
+ insert(q_to_sec(str));
if (e->source() == this) {
if (e->dropAction() == Qt::MoveAction) {
if (selStart > oldSelStart && selStart <= oldSelEnd)
@@ -2527,7 +2528,7 @@
Q_Q(QSecureLineEdit);
dndTimer.stop();
QMimeData *data = new QMimeData;
- data->setText(q->selectedText());
+ data->setText(sec_to_q(q->selectedText()));
QDrag *drag = new QDrag(q);
drag->setMimeData(data);
Qt::DropAction action = drag->start();
@@ -2611,8 +2612,8 @@
d->actions[QSecureLineEditPrivate::CopyAct]->setEnabled(false);
d->actions[QSecureLineEditPrivate::PasteAct]->setEnabled(false);
#endif
- d->actions[QSecureLineEditPrivate::ClearAct]->setEnabled(!d->readOnly && !d->text.isEmpty() && d->hasSelectedText());
- d->actions[QSecureLineEditPrivate::SelectAllAct]->setEnabled(!d->text.isEmpty() && !d->allSelected());
+ d->actions[QSecureLineEditPrivate::ClearAct]->setEnabled(!d->readOnly && !d->text.empty() && d->hasSelectedText());
+ d->actions[QSecureLineEditPrivate::SelectAllAct]->setEnabled(!d->text.empty() && !d->allSelected());
QMenu *popup = new QMenu(this);
popup->setObjectName(QLatin1String("qt_edit_menu"));
@@ -2639,9 +2640,6 @@
#else
if (!d->readOnly) {
#endif
- popup->addSeparator();
- QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, popup);
- popup->addMenu(ctrlCharacterMenu);
}
return popup;
}