emailuis/nmailuiwidgets/src/nmeditortextedit.cpp
changeset 23 2dc6caa42ec3
parent 18 578830873419
child 27 9ba4404ef423
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    39 */
    39 */
    40 NmEditorTextEdit::~NmEditorTextEdit()
    40 NmEditorTextEdit::~NmEditorTextEdit()
    41 {
    41 {
    42 }
    42 }
    43 
    43 
    44 void NmEditorTextEdit::init(NmEditorContent *parent, NmBaseViewScrollArea *bgScrollArea)
    44 void NmEditorTextEdit::init(NmBaseViewScrollArea *bgScrollArea)
    45 {
    45 {
    46     mPreviousContentsHeight = 0;
    46     mPreviousContentsHeight = 0;
    47     mFirstTime = true;
    47     mFirstTime = true;
    48     mCustomTextColor = QPair<bool, QColor>(false,Qt::black);
    48     mCustomTextColor = QPair<bool, QColor>(false,Qt::black);
    49     mParent = parent;
       
    50     mBackgroundScrollArea = bgScrollArea;
    49     mBackgroundScrollArea = bgScrollArea;
    51     mHeaderHeight = (int)HeightOfTheHeaderOnStartup;
    50     mHeaderHeight = (int)HeightOfTheHeaderOnStartup;
    52     mBgScrollPosition.setX(0);
    51     mBgScrollPosition.setX(0);
    53     mBgScrollPosition.setY(0);
    52     mBgScrollPosition.setY(0);
    54     document()->setDocumentMargin(BodyMargin);
    53     document()->setDocumentMargin(BodyMargin);
    63     mScrollArea->setAcceptedMouseButtons(Qt::NoButton);
    62     mScrollArea->setAcceptedMouseButtons(Qt::NoButton);
    64 
    63 
    65     connect(this, SIGNAL(contentsChanged()), this, SLOT(updateEditorHeight()));
    64     connect(this, SIGNAL(contentsChanged()), this, SLOT(updateEditorHeight()));
    66     connect(this, SIGNAL(cursorPositionChanged(int, int)),
    65     connect(this, SIGNAL(cursorPositionChanged(int, int)),
    67             this, SLOT(setScrollPosition(int, int)));
    66             this, SLOT(setScrollPosition(int, int)));
    68     connect(this, SIGNAL(setEditorContentHeight()), mParent, SLOT(setEditorContentHeight()));
       
    69     connect(this, SIGNAL(contentsChanged()), this, SLOT(updateCustomTextColor()));
    67     connect(this, SIGNAL(contentsChanged()), this, SLOT(updateCustomTextColor()));
    70 }
    68 }
    71 
    69 
    72 /*!
    70 /*!
    73     This function returns the height (pixels) of the body fields document content.
    71     This function returns the height (pixels) of the body fields document content.
    92         mPreviousContentsHeight = heightOfTheTextEdit;
    90         mPreviousContentsHeight = heightOfTheTextEdit;
    93         setPreferredHeight(heightOfTheTextEdit);
    91         setPreferredHeight(heightOfTheTextEdit);
    94         setMaximumHeight(heightOfTheTextEdit);
    92         setMaximumHeight(heightOfTheTextEdit);
    95     }
    93     }
    96     // Inform parent that content height has been changed
    94     // Inform parent that content height has been changed
    97     emit setEditorContentHeight();
    95     emit editorContentHeightChanged();
    98 }
    96 }
    99 
    97 
   100 /*!
    98 /*!
   101     This slot is called when cursor position is changed in body area using
    99     This slot is called when cursor position is changed in body area using
   102     'pointing stick' or keyboard. Function will update the scroll position
   100     'pointing stick' or keyboard. Function will update the scroll position