← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-terminal-app/fix-1488588 into lp:ubuntu-terminal-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-terminal-app/fix-1488588 into lp:ubuntu-terminal-app.

Commit message:
* Expose drag mode settings to QML
* Disabled drag support in ubuntu-terminal-app in order to workaround the missing support in Mir

Requested reviews:
  Ubuntu Terminal Developers (ubuntu-terminal-dev)
Related bugs:
  Bug #1488588 in Ubuntu Terminal App: "Terminal creates a new surface when selecting text"
  https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1488588

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-terminal-app/fix-1488588/+merge/290031

* Expose drag mode settings to QML
* Disabled drag support in ubuntu-terminal-app in order to workaround the missing support in Mir
-- 
Your team Ubuntu Terminal Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-terminal-app/fix-1488588 into lp:ubuntu-terminal-app.
=== modified file 'src/app/qml/TerminalComponent.qml'
--- src/app/qml/TerminalComponent.qml	2016-02-06 16:31:36 +0000
+++ src/app/qml/TerminalComponent.qml	2016-03-24 12:38:21 +0000
@@ -14,6 +14,10 @@
         font.family: settings.fontStyle
         font.pixelSize: FontUtils.sizeToPixels("medium") * settings.fontSize / 10
 
+        // WORKAROUND: Mir/QtMir does not support drag&drop yet, therefore we need
+        // to disable this functionality (see lp:1488588).
+        dragMode: QMLTermWidget.NoDrag
+
         signal sessionFinished(var session);
 
         session: QMLTermSession {

=== modified file 'src/plugin/qmltermwidget/lib/TerminalDisplay.cpp'
--- src/plugin/qmltermwidget/lib/TerminalDisplay.cpp	2016-02-08 21:51:41 +0000
+++ src/plugin/qmltermwidget/lib/TerminalDisplay.cpp	2016-03-24 12:38:21 +0000
@@ -329,7 +329,7 @@
 ,_cursorBlinking(false)
 ,_hasBlinkingCursor(false)
 ,_allowBlinkingText(true)
-,_ctrlDrag(false)
+,_dragMode(CtrlKeyDrag)
 ,_tripleClickMode(SelectWholeLine)
 ,_isFixedSize(false)
 ,_possibleTripleClick(false)
@@ -1804,7 +1804,8 @@
     
     selected =  _screenWindow->isSelected(pos.x(),pos.y());
 
-    if ((!_ctrlDrag || ev->modifiers() & Qt::ControlModifier) && selected ) {
+    if (((_dragMode == DragMode::CtrlKeyDrag && ev->modifiers() & Qt::ControlModifier) ||
+         _dragMode == DragMode::MouseDrag) && selected ) {
       // The user clicked inside selected text
       dragInfo.state = diPending;
       dragInfo.start = ev->pos();

=== modified file 'src/plugin/qmltermwidget/lib/TerminalDisplay.h'
--- src/plugin/qmltermwidget/lib/TerminalDisplay.h	2016-02-07 07:31:59 +0000
+++ src/plugin/qmltermwidget/lib/TerminalDisplay.h	2016-03-24 12:38:21 +0000
@@ -83,6 +83,7 @@
 class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QQuickPaintedItem
 {
    Q_OBJECT
+   Q_ENUMS(DragMode)
    Q_PROPERTY(KSession* session         READ getSession      WRITE setSession     NOTIFY sessionChanged          )
    Q_PROPERTY(QFont font                READ getVTFont       WRITE setVTFont                                     )
    Q_PROPERTY(QString  colorScheme                           WRITE setColorScheme                                )
@@ -95,7 +96,8 @@
    Q_PROPERTY(int scrollbarMaximum      READ getScrollbarMaximum                  NOTIFY scrollbarParamsChanged  )
    Q_PROPERTY(int scrollbarMinimum      READ getScrollbarMinimum                  NOTIFY scrollbarParamsChanged  )
    Q_PROPERTY(QSize fontMetrics         READ getFontMetrics                       NOTIFY changedFontMetricSignal )
-   Q_PROPERTY(bool enableBold                                WRITE setBoldIntense)
+   Q_PROPERTY(bool enableBold                                WRITE setBoldIntense                                )
+   Q_PROPERTY(DragMode dragMode         MEMBER _dragMode                          NOTIFY dragModeChanged         )
 
 public:
     /** Constructs a new terminal display widget with the specified parent. */
@@ -194,8 +196,11 @@
     /** Specifies whether or not text can blink. */
     void setBlinkingTextEnabled(bool blink);
 
-    void setCtrlDrag(bool enable) { _ctrlDrag=enable; }
-    bool ctrlDrag() { return _ctrlDrag; }
+    enum DragMode {
+        NoDrag,         // drag disabled
+        CtrlKeyDrag,    // require Ctrl key for drag
+        MouseDrag       // no additional key is required
+    };
 
     /** 
      *  This enum describes the methods for selecting text when
@@ -614,6 +619,7 @@
     void imagePainted();
     void scrollbarValueChanged();
     void scrollbarParamsChanged(int value);
+    void dragModeChanged();
 
 protected:
     virtual bool event( QEvent * );
@@ -821,7 +827,7 @@
     bool _cursorBlinking;     // hide cursor in paintEvent
     bool _hasBlinkingCursor;  // has blinking cursor enabled
     bool _allowBlinkingText;  // allow text to blink
-    bool _ctrlDrag;           // require Ctrl key for drag
+    DragMode _dragMode;
     TripleClickMode _tripleClickMode;
     bool _isFixedSize; //Columns / lines are locked.
     QTimer* _blinkTimer;  // active when hasBlinker


Follow ups