Logo Search packages:      
Sourcecode: mailody-kde4 version File versions  Download package

HeaderWidget::HeaderWidget ( QWidget *  parent = 0  )  [explicit]

Contructor

Definition at line 44 of file headerwidget.cpp.

References Mailody::SearchLine::setProxy().

        : QWidget( parent )
{
    QVBoxLayout *layout = new QVBoxLayout( this );

    QTime aaaa;
    aaaa.start();

    // Proxy and search
    m_headerProxy = new HeaderProxy( this );
    m_searchLine = new SearchLine( this );
    m_searchLine->setProxy( m_headerProxy );

    // headerview
    m_headerView = new HeaderView( this );
    m_headerView->scrollToBottom();
    m_headerView->header()->setDefaultSectionSize( 200 );
    m_headerView->header()->setMinimumSectionSize( 50 );
    m_headerView->header()->setResizeMode( QHeaderView::Interactive );
    m_headerView->setSelectionMode( QAbstractItemView::ExtendedSelection );
    m_headerView->setSelectionBehavior( QAbstractItemView::SelectRows );

    // messageview
    m_messageModel = new Akonadi::MessageModel( this );
    m_headerProxy->setSourceModel( m_messageModel );
    m_headerView->setModel( m_headerProxy );

    connect( m_headerView, SIGNAL( clicked( QModelIndex ) ), SLOT( itemActivated( QModelIndex ) ) );

    layout->addWidget( m_searchLine );
    layout->addWidget( m_headerView );

    kDebug() << "Finished:" << aaaa.elapsed() << "ms";

    // retrieve columnsizes and set them
    KConfigGroup config = KGlobal::config()->group( "HeaderWidget" );
    m_headerView->setColumnSizes( config.readEntry( "headers", QList<int>() ) );
    int sortColumn = config.readEntry( "sortColumn", 2 );
    Qt::SortOrder sortOrder = ( Qt::SortOrder )config.readEntry( "sortOrder",0 );
    m_headerView->setSortingEnabled( true );
    m_headerView->sortByColumn( sortColumn, sortOrder );
    m_headerView->header()->setSortIndicator( sortColumn, sortOrder );
    m_headerProxy->setHideDeleted( true );

    // start a monitor
    m_monitor = new Akonadi::Monitor( this );
    connect( m_monitor, SIGNAL( itemChanged( const Akonadi::Item&, const QSet< QByteArray >& ) ),
             SLOT( slotItemChanged( const Akonadi::Item& ) ) );
}


Generated by  Doxygen 1.6.0   Back to index