Commit 9484507f authored by Kurt Hindenburg's avatar Kurt Hindenburg

Add option to insert DnD URLs as plain text

This patch allows the dnd menu to be disabled, making it possible to
drag and drop URLs as text by default.

Thanks to Peter Wu peter lekensteyn nl for patch

REVIEW: 124908
BUG: 304290
parent 176f0d51
......@@ -1041,6 +1041,10 @@ void EditProfileDialog::setupMousePage(const Profile::Ptr profile)
_ui->openLinksByDirectClickButton , Profile::OpenLinksByDirectClickEnabled,
SLOT(toggleOpenLinksByDirectClick(bool))
},
{
_ui->dropUrlsAsText , Profile::DropUrlsAsText,
SLOT(toggleDropUrlsAsText(bool))
},
{ 0 , Profile::Property(0) , 0 }
};
setupCheckBoxes(options , profile);
......@@ -1171,6 +1175,10 @@ void EditProfileDialog::toggleCtrlRequiredForDrag(bool enable)
{
updateTempProfileProperty(Profile::CtrlRequiredForDrag, enable);
}
void EditProfileDialog::toggleDropUrlsAsText(bool enable)
{
updateTempProfileProperty(Profile::DropUrlsAsText, enable);
}
void EditProfileDialog::toggleOpenLinksByDirectClick(bool enable)
{
updateTempProfileProperty(Profile::OpenLinksByDirectClickEnabled, enable);
......
......@@ -157,6 +157,7 @@ private slots:
void toggleUnderlineLinks(bool);
void toggleOpenLinksByDirectClick(bool);
void toggleCtrlRequiredForDrag(bool);
void toggleDropUrlsAsText(bool);
void toggleCopyTextToClipboard(bool);
void toggleTrimTrailingSpacesInSelectedText(bool);
void pasteFromX11Selection();
......
......@@ -1014,6 +1014,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="dropUrlsAsText">
<property name="toolTip">
<string>Always paste dropped URLs as text without offering move, copy and link actions.</string>
</property>
<property name="text">
<string>Disable drag and drop menu for URLs and files</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableMouseWheelZoomButton">
<property name="toolTip">
......
......@@ -106,6 +106,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { UnderlineLinksEnabled , "UnderlineLinksEnabled" , INTERACTION_GROUP , QVariant::Bool }
, { OpenLinksByDirectClickEnabled , "OpenLinksByDirectClickEnabled" , INTERACTION_GROUP , QVariant::Bool }
, { CtrlRequiredForDrag, "CtrlRequiredForDrag" , INTERACTION_GROUP , QVariant::Bool }
, { DropUrlsAsText , "DropUrlsAsText" , INTERACTION_GROUP , QVariant::Bool }
, { AutoCopySelectedText , "AutoCopySelectedText" , INTERACTION_GROUP , QVariant::Bool }
, { TrimTrailingSpacesInSelectedText , "TrimTrailingSpacesInSelectedText" , INTERACTION_GROUP , QVariant::Bool }
, { PasteFromSelectionEnabled , "PasteFromSelectionEnabled" , INTERACTION_GROUP , QVariant::Bool }
......@@ -177,6 +178,7 @@ FallbackProfile::FallbackProfile()
setProperty(CtrlRequiredForDrag, true);
setProperty(AutoCopySelectedText, false);
setProperty(TrimTrailingSpacesInSelectedText, false);
setProperty(DropUrlsAsText, false);
setProperty(PasteFromSelectionEnabled, true);
setProperty(PasteFromClipboardEnabled, false);
setProperty(MiddleClickPasteMode, Enum::PasteFromX11Selection);
......
......@@ -204,6 +204,8 @@ public:
AutoCopySelectedText,
/** (bool) If true, trailing spaces are trimmed in selected text */
TrimTrailingSpacesInSelectedText,
/** (bool) If true, then dropped URLs will be pasted as text without asking */
DropUrlsAsText,
/** (bool) If true, middle mouse button pastes from X Selection */
PasteFromSelectionEnabled,
/** (bool) If true, middle mouse button pastes from Clipboard */
......
......@@ -3254,7 +3254,7 @@ void TerminalDisplay::dropEvent(QDropEvent* event)
// If our target is local we will open a popup - otherwise the fallback kicks
// in and the URLs will simply be pasted as text.
if (_sessionController && _sessionController->url().isLocalFile()) {
if (!_dropUrlsAsText && _sessionController && _sessionController->url().isLocalFile()) {
// A standard popup with Copy, Move and Link as options -
// plus an additional Paste option.
......
......@@ -163,6 +163,13 @@ public:
return _ctrlRequiredForDrag;
}
void setDropUrlsAsText(bool enable) {
_dropUrlsAsText = enable;
}
bool getDropUrlsAsText() const {
return _dropUrlsAsText;
}
/** Sets how the text is selected when the user triple clicks within the display. */
void setTripleClickMode(Enum::TripleClickModeEnum mode) {
_tripleClickMode = mode;
......@@ -851,6 +858,7 @@ private:
bool _openLinksByDirectClick; // Open URL and hosts by single mouse click
bool _ctrlRequiredForDrag; // require Ctrl key for drag selected text
bool _dropUrlsAsText; // always paste URLs as text without showing copy/move menu
Enum::TripleClickModeEnum _tripleClickMode;
bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
......
......@@ -810,6 +810,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->setDropUrlsAsText(profile->property<bool>(Profile::DropUrlsAsText));
view->setBidiEnabled(profile->bidiRenderingEnabled());
view->setLineSpacing(profile->lineSpacing());
view->setTrimTrailingSpaces(profile->property<bool>(Profile::TrimTrailingSpacesInSelectedText));
......
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