summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlinecontrol.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-01-14 12:35:08 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-01-14 12:35:08 (GMT)
commitd88a7e7a76deaa0c0e36d94a001d6f64834e22c2 (patch)
tree80b604a84c06efaa36ddf5e6eb324caf8aea66b0 /src/gui/widgets/qlinecontrol.cpp
parent645f29c727f33cc9f8b00b8efcb658a050ac6a26 (diff)
parentf17aeadf56818e5f20e20eb91450e66adb88c99b (diff)
downloadQt-d88a7e7a76deaa0c0e36d94a001d6f64834e22c2.zip
Qt-d88a7e7a76deaa0c0e36d94a001d6f64834e22c2.tar.gz
Qt-d88a7e7a76deaa0c0e36d94a001d6f64834e22c2.tar.bz2
Merge remote branch 'origin/4.6' into lighthouse
Conflicts: configure src/corelib/global/qglobal.cpp src/gui/dialogs/dialogs.pri
Diffstat (limited to 'src/gui/widgets/qlinecontrol.cpp')
-rw-r--r--src/gui/widgets/qlinecontrol.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index ac3609c..b7ff1ee 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -138,7 +138,12 @@ void QLineControl::copy(QClipboard::Mode mode) const
*/
void QLineControl::paste()
{
- insert(QApplication::clipboard()->text(QClipboard::Clipboard));
+ QString clip = QApplication::clipboard()->text(QClipboard::Clipboard);
+ if (!clip.isEmpty() || hasSelectedText()) {
+ separate(); //make it a separate undo/redo command
+ insert(clip);
+ separate();
+ }
}
#endif // !QT_NO_CLIPBOARD
@@ -1581,16 +1586,16 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
}
}
#endif //QT_NO_CLIPBOARD
- else if (event == QKeySequence::MoveToStartOfLine) {
+ else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
home(0);
}
- else if (event == QKeySequence::MoveToEndOfLine) {
+ else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) {
end(0);
}
- else if (event == QKeySequence::SelectStartOfLine) {
+ else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) {
home(1);
}
- else if (event == QKeySequence::SelectEndOfLine) {
+ else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) {
end(1);
}
else if (event == QKeySequence::MoveToNextChar) {
@@ -1666,6 +1671,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
}
#endif // QT_NO_SHORTCUT
else {
+ bool handled = false;
#ifdef Q_WS_MAC
if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) {
Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier);
@@ -1683,6 +1689,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
event->key() == Qt::Key_Up ? home(0) : end(0);
}
}
+ handled = true;
}
#endif
if (event->modifiers() & Qt::ControlModifier) {
@@ -1715,7 +1722,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
break;
#endif
default:
- unknown = true;
+ if (!handled)
+ unknown = true;
}
} else { // ### check for *no* modifier
switch (event->key()) {
@@ -1748,7 +1756,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
#endif
default:
- unknown = true;
+ if (!handled)
+ unknown = true;
}
}
}