Removes document trailing white spaces.

        :return: Method success.
        :rtype: bool

def remove_trailing_white_spaces(self):
        """
        Removes document trailing white spaces.

        :return: Method success.
        :rtype: bool
        """

        cursor = self.textCursor()

        block = self.document().findBlockByLineNumber(0)
        while block.isValid():
            cursor.setPosition(block.position())
            if re.search(r"\s+$", block.text()):
                cursor.movePosition(QTextCursor.EndOfBlock)
                cursor.movePosition(QTextCursor.StartOfBlock, QTextCursor.KeepAnchor)
                cursor.insertText(foundations.strings.to_string(block.text()).rstrip())
            block = block.next()
        cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)
        if not cursor.block().text().isEmpty():
            cursor.insertText("\n")
        return True