#include <kapplication.h>

#include "kstextview.h"

class Timer : public QObject
{
public:
    Timer( KSirc::TextView *view )
	: m_view( view ), m_lines( 0 )
    {
	startTimer( 1000 );
    }
    void timerEvent( QTimerEvent * )
    {
	m_lines++;
	if ( m_lines > 5 )
	    m_view->removeParag( m_view->firstParag() );

        m_view->appendParag( QString::fromLatin1( "aaaaaa bbbbbb cccccccc ddddddddd eeeeeee" ) );
	m_view->setContentsPos( 0, m_view->contentsHeight() );
    }
private:
    KSirc::TextView *m_view;
    int m_lines;
};

int main( int argc, char **argv )
{
    KApplication app( argc, argv, "kstextviewtest" );

    KSirc::TextView view( 0 );
    app.setMainWidget( &view );

    view.show();
    /*
    view.appendParag( QString::fromLatin1( "<b>bold</b>Normal<i>Italic hey!</i>" ) );
    view.appendParag( QString::fromLatin1( "bleh foo hey bar schubidu bliep blop" ) );
    view.appendParag( QString::fromLatin1( "more longish paragraphs .. yaddayadda yadda" ) );
    view.appendParag( QString::fromLatin1( "&lt;tronical&gt; hah! &amp;" ) );
    view.appendParag( QString::fromLatin1( "<a href=\"http://www.kde.org/\">url</a>" ) );
    view.appendParag( QString::fromLatin1( "<font color=#0000ff>color test</font>" ) );
    view.appendParag( QString::fromLatin1( "<font color=\"#00ff00\">another color test</font>" ) );
    view.appendParag( QString::fromLatin1( "<i bleh>simple attr test</i>" ) );
    view.appendParag( QString::fromLatin1( "aaaaaa bbbbbb cccccccc ddddddddd eeeeeee" ) );
    */
    Timer t( &view );

    return app.exec();
}

