Commit ed31a8b0 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Provde a GUI option to disable requiring CTRL to dnd text

This adds a GUI checkbox per profile to enable/disable requiring the
CTRL key to drag-n-drop text.
The default is to require the CTRL key as before.

Thanks to Scott Kitterman (kde@kitterman.com) for patch.

BUG: 165923
REVIEW: 105423
FIXED-IN: 4.10
parent 6dcc2874
......@@ -985,6 +985,10 @@ void EditProfileDialog::setupMousePage(const Profile::Ptr profile)
_ui->underlineLinksButton , Profile::UnderlineLinksEnabled,
SLOT(toggleUnderlineLinks(bool))
},
{
_ui->ctrlRequiredForDragButton, Profile::CtrlRequiredForDrag,
SLOT(toggleCtrlRequiredForDrag(bool))
},
{
_ui->copyTextToClipboardButton , Profile::AutoCopySelectedText,
SLOT(toggleCopyTextToClipboard(bool))
......@@ -1103,6 +1107,10 @@ void EditProfileDialog::toggleUnderlineLinks(bool enable)
{
updateTempProfileProperty(Profile::UnderlineLinksEnabled, enable);
}
void EditProfileDialog::toggleCtrlRequiredForDrag(bool enable)
{
updateTempProfileProperty(Profile::CtrlRequiredForDrag, enable);
}
void EditProfileDialog::toggleCopyTextToClipboard(bool enable)
{
updateTempProfileProperty(Profile::AutoCopySelectedText, enable);
......
......@@ -150,6 +150,7 @@ private slots:
// mouse page
void toggleUnderlineLinks(bool);
void toggleCtrlRequiredForDrag(bool);
void toggleCopyTextToClipboard(bool);
void pasteFromX11Selection();
void pasteFromClipboard();
......
......@@ -838,6 +838,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ctrlRequiredForDragButton">
<property name="toolTip">
<string>Selected text will require control key plus click to drag.</string>
</property>
<property name="text">
<string>Require Ctrl key for drag and drop</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -103,6 +103,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { WordCharacters , "WordCharacters" , INTERACTION_GROUP , QVariant::String }
, { TripleClickMode , "TripleClickMode" , INTERACTION_GROUP , QVariant::Int }
, { UnderlineLinksEnabled , "UnderlineLinksEnabled" , INTERACTION_GROUP , QVariant::Bool }
, { CtrlRequiredForDrag, "CtrlRequiredForDrag" , INTERACTION_GROUP , QVariant::Bool }
, { AutoCopySelectedText , "AutoCopySelectedText" , INTERACTION_GROUP , QVariant::Bool }
, { PasteFromSelectionEnabled , "PasteFromSelectionEnabled" , INTERACTION_GROUP , QVariant::Bool }
, { PasteFromClipboardEnabled , "PasteFromClipboardEnabled" , INTERACTION_GROUP , QVariant::Bool }
......@@ -167,6 +168,7 @@ FallbackProfile::FallbackProfile()
setProperty(FlowControlEnabled, true);
setProperty(BlinkingTextEnabled, true);
setProperty(UnderlineLinksEnabled, true);
setProperty(CtrlRequiredForDrag, true);
setProperty(AutoCopySelectedText, false);
setProperty(PasteFromSelectionEnabled, true);
setProperty(PasteFromClipboardEnabled, false);
......
......@@ -196,6 +196,8 @@ public:
* underlined when hovered by the mouse pointer.
*/
UnderlineLinksEnabled,
/** (bool) If true, control key must be pressed to click and drag selected text. */
CtrlRequiredForDrag,
/** (bool) If true, automatically copy selected text into the clipboard */
AutoCopySelectedText,
/** (bool) If true, middle mouse button pastes from X Selection */
......
......@@ -314,7 +314,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
, _hasTextBlinker(false)
, _underlineLinks(true)
, _isFixedSize(false)
, _ctrlDrag(true)
, _ctrlRequiredForDrag(true)
, _tripleClickMode(Enum::SelectWholeLine)
, _possibleTripleClick(false)
, _resizeWidget(0)
......@@ -1779,8 +1779,8 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
// The user clicked inside selected text
selected = _screenWindow->isSelected(pos.x(), pos.y());
// Drag only when the Control key is hold
if ((!_ctrlDrag || ev->modifiers() & Qt::ControlModifier) && selected) {
// Drag only when the Control key is held
if ((!_ctrlRequiredForDrag || ev->modifiers() & Qt::ControlModifier) && selected) {
_dragInfo.state = diPending;
_dragInfo.start = ev->pos();
} else {
......
......@@ -150,11 +150,11 @@ public:
/** Specifies whether or not text can blink. */
void setBlinkingTextEnabled(bool blink);
void setCtrlDrag(bool enable) {
_ctrlDrag = enable;
void setControlDrag(bool enable) {
_ctrlRequiredForDrag = enable;
}
bool ctrlDrag() const {
return _ctrlDrag;
bool ctrlRequiredForDrag() const {
return _ctrlRequiredForDrag;
}
/** Sets how the text is selected when the user triple clicks within the display. */
......@@ -766,7 +766,7 @@ private:
bool _underlineLinks; // Underline URL and hosts on mouse hover
bool _isFixedSize; // columns/lines are locked.
bool _ctrlDrag; // require Ctrl key for drag selected text
bool _ctrlRequiredForDrag; // require Ctrl key for drag selected text
Enum::TripleClickModeEnum _tripleClickMode;
bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
......
......@@ -803,6 +803,7 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
view->setAutoCopySelectedText(profile->autoCopySelectedText());
view->setUnderlineLinks(profile->underlineLinksEnabled());
view->setControlDrag(profile->property<bool>(Profile::CtrlRequiredForDrag));
view->setBidiEnabled(profile->bidiRenderingEnabled());
int middleClickPasteMode = profile->property<int>(Profile::MiddleClickPasteMode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment