let's use undo
authorcoolo <coolo@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Fri, 7 Dec 2007 17:14:28 +0000 (17:14 +0000)
committercoolo <coolo@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Fri, 7 Dec 2007 17:14:28 +0000 (17:14 +0000)
git-svn-id: http://svn.opensuse.org/svn/yast/trunk/qt4@42829 e0cc52ee-31ee-0310-8b87-e83c4596d67c

src/YQMultiLineEdit.cc

index a031085..d814d80 100644 (file)
@@ -105,52 +105,8 @@ void YQMultiLineEdit::setInputMaxLength( int newMaxLength )
 
 void YQMultiLineEdit::enforceMaxInputLength()
 {
-#if FIXME
-    if ( inputMaxLength() >= 0 && _qt_textEdit->length() > inputMaxLength() )
-    {
-       int index;
-       int para;
-
-       _qt_textEdit->getCursorPosition( &para, &index);
-
-       QString text = _qt_textEdit->document()->toPlainText();
-
-       int pos = 0; // current positon in text
-       int section =0; // section in text;
-       // iterate over the string
-
-       while ( pos != (int) text.length()+1 )
-       {
-           // we reached the paragraph where the user entered
-           // a character
-           if ( section == para )
-           {
-               // remove that character
-               text.remove( pos+index-1, 1 );
-               break;
-           }
-
-           // new paragraph begins
-           if ( text[pos] == '\n' )
-               section++;
-
-           pos++;
-       }
-
-       _qt_textEdit->setText( text );
-
-       // user removed a paragraph
-       if ( index == 0 )
-       {
-           --para;
-           // the new index is the end of the previous paragraph
-           index = _qt_textEdit->paragraphLength(para) + 1;
-       }
-
-       // adjust to new cursor position before the removed character
-       _qt_textEdit->setCursorPosition( para, index-1 );
-    }
-#endif
+    if ( inputMaxLength() >= 0 && _qt_textEdit->toPlainText().length() > inputMaxLength() )
+        _qt_textEdit->undo();
 }