Logo Search packages:      
Sourcecode: akregator version File versions

View::View ( Akregator::Part part,
QWidget *  parent,
const char *  name 
)

constructor

Parameters:
part the Akregator::Part which contains this widget
parent parent widget
name the name of the widget (QWidget )

Definition at line 93 of file akregator_view.cpp.

References delayedInit(), Akregator::ArticleViewer::displayAboutPage(), m_articles, m_articleViewer, m_feedList, m_tabs, m_tree, slotArticleListContextMenu(), slotArticleSelected(), slotCombinedView(), slotFeedFetched(), slotFeedTreeContextMenu(), slotFeedURLDropped(), slotFrameChanged(), slotMouseButtonPressed(), slotMouseOverInfo(), slotNodeSelected(), slotNormalView(), slotOpenArticleExternal(), slotOpenTab(), and slotWidescreenView().

 : QWidget(parent, name), m_viewMode(NormalView)
{
     m_keepFlagIcon = QPixmap(locate("data", "akregator/pics/akregator_flag.png"));
    m_part = part;
    m_feedList = new FeedList();
    m_shuttingDown = false;
    m_displayingAboutPage = false;
    m_currentFrame = 0L;
    setFocusPolicy(QWidget::StrongFocus);

    QVBoxLayout *lt = new QVBoxLayout( this );

    m_feedSplitter = new QSplitter(QSplitter::Horizontal, this, "panner1");
    m_feedSplitter->setOpaqueResize( true );
    lt->addWidget(m_feedSplitter);

    m_transaction= new FetchTransaction(this);
    connect (m_transaction, SIGNAL(fetched(Feed*)), this, SLOT(slotFeedFetched(Feed*)));
    connect (m_transaction, SIGNAL(fetchError(Feed*)), this, SLOT(slotFeedFetchError(Feed*)));
    connect (m_transaction, SIGNAL(completed()), this, SLOT(slotFetchesCompleted()));

    m_tree = new FeedsTree( m_feedSplitter, "FeedsTree" );
    
    m_tree->setFeedList(m_feedList);
    
    connect(m_tree, SIGNAL(signalContextMenu(KListView*, TreeNodeItem*, const QPoint&)),
            this, SLOT(slotFeedTreeContextMenu(KListView*, TreeNodeItem*, const QPoint&)));
    
    connect(m_tree, SIGNAL(signalNodeSelected(TreeNode*)), this, SLOT(slotNodeSelected(TreeNode*)));
    
    connect(m_tree, SIGNAL(signalDropped (KURL::List &, TreeNodeItem*, FeedGroupItem*)),
            this, SLOT(slotFeedURLDropped (KURL::List &,
                        TreeNodeItem*, FeedGroupItem*)));

    m_feedSplitter->setResizeMode( m_tree, QSplitter::KeepSize );

    m_tabs = new TabWidget(m_feedSplitter);
    
    connect( m_part, SIGNAL(signalSettingsChanged()), m_tabs, SLOT(slotSettingsChanged()));
    m_tabsClose = new QToolButton( m_tabs );
    m_tabsClose->setAccel(QKeySequence("Ctrl+W"));
    connect( m_tabsClose, SIGNAL( clicked() ), this,
            SLOT( slotRemoveFrame() ) );

    m_tabsClose->setIconSet( SmallIconSet( "tab_remove" ) );
    m_tabsClose->adjustSize();
    QToolTip::add(m_tabsClose, i18n("Close the current tab"));
    m_tabs->setCornerWidget( m_tabsClose, TopRight );

    connect( m_tabs, SIGNAL( currentFrameChanged(Frame *) ), this,
            SLOT( slotFrameChanged(Frame *) ) );

    QWhatsThis::add(m_tabs, i18n("You can view multiple articles in several open tabs."));

    m_mainTab = new QWidget(this, "Article Tab");
    QVBoxLayout *mainTabLayout = new QVBoxLayout( m_mainTab, 0, 2, "mainTabLayout");

    QWhatsThis::add(m_mainTab, i18n("Articles list."));

    m_searchBar = new QHBox(m_mainTab);
    m_searchBar->setMargin(2);
    m_searchBar->setSpacing(5);
    m_searchBar->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
    QToolButton *clearButton = new QToolButton( m_searchBar );
    clearButton->setIconSet( SmallIconSet( QApplication::reverseLayout() ? "clear_left" : "locationbar_erase" ) );
    
    clearButton->setAutoRaise(true);
    
    QLabel* searchLabel = new QLabel(m_searchBar);
    searchLabel->setText( i18n("S&earch:") );
    
    m_searchLine = new KLineEdit(m_searchBar, "searchline");
    searchLabel->setBuddy(m_searchLine);

    QLabel* statusLabel = new QLabel(m_searchBar);
    statusLabel->setText( i18n("Status:") );
    
    m_searchCombo = new KComboBox(m_searchBar, "searchcombo");
    mainTabLayout->add(m_searchBar);
    
    if ( !Settings::showQuickFilter() )    
        m_searchBar->hide();
    
    m_searchCombo->insertItem(i18n("All Articles"));
    m_searchCombo->insertItem(i18n("New & Unread"));
    m_searchCombo->insertItem(i18n("New"));
    m_searchCombo->insertItem(i18n("Unread"));
    m_searchCombo->insertItem(i18n("Keep Flag Set"));

    QToolTip::add( clearButton, i18n( "Clear filter" ) );
    QToolTip::add( m_searchLine, i18n( "Enter space-separated terms to filter article list" ) );
    QToolTip::add( m_searchCombo, i18n( "Choose what kind of articles to show in article list" ) );

    connect(clearButton, SIGNAL( clicked() ),
                    m_searchLine, SLOT(clear()) );
    connect(m_searchCombo, SIGNAL(activated(int)),
                        this, SLOT(slotSearchComboChanged(int)));
    connect(m_searchLine, SIGNAL(textChanged(const QString &)),
                        this, SLOT(slotSearchTextChanged(const QString &)));

    m_currentTextFilter=0;
    m_currentStatusFilter=0;
    m_queuedSearches=0;
    m_fetchTimer=0;

    m_articleSplitter = new QSplitter(QSplitter::Vertical, m_mainTab, "panner2");

    m_articles = new ArticleList( m_articleSplitter, "articles" );
    
    connect( m_articles, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int)), this, SLOT(slotMouseButtonPressed(int, QListViewItem *, const QPoint &, int)));

    // use selectionChanged instead of clicked
    connect( m_articles, SIGNAL(signalArticleSelected(MyArticle)),
                this, SLOT( slotArticleSelected(MyArticle)) );
    connect( m_articles, SIGNAL(signalDoubleClicked(ArticleListItem*, const QPoint&, int)),
                this, SLOT( slotOpenArticleExternal(ArticleListItem*, const QPoint&, int)) );

    connect(m_articles, SIGNAL(signalContextMenu(KListView*, ArticleListItem*, const QPoint&)),
            this, SLOT(slotArticleListContextMenu(KListView*, ArticleListItem*, const QPoint&)));
    
    m_articleViewer = new ArticleViewer(m_articleSplitter, "article_viewer");
    m_articleViewer->setSafeMode();  // disable JS, Java, etc...

    connect( m_articleViewer, SIGNAL(urlClicked(const KURL&, bool)),
                        this, SLOT(slotOpenTab(const KURL&, bool)) );

    connect( m_articleViewer->browserExtension(), SIGNAL(mouseOverInfo(const KFileItem *)),
                                            this, SLOT(slotMouseOverInfo(const KFileItem *)) );

    connect( m_part, SIGNAL(signalSettingsChanged()), m_articleViewer, SLOT(slotPaletteOrFontChanged()));
    QWhatsThis::add(m_articleViewer->widget(), i18n("Browsing area."));
    mainTabLayout->addWidget( m_articleSplitter );

    m_mainFrame=new Frame(this, m_part, m_mainTab, i18n("Articles"), false);
    connectFrame(m_mainFrame);
    m_tabs->addFrame(m_mainFrame);

    m_feedSplitter->setSizes( Settings::splitter1Sizes() );
    m_articleSplitter->setSizes( Settings::splitter2Sizes() );

    m_searchCombo->setCurrentItem(Settings::quickFilter());
    slotSearchComboChanged(Settings::quickFilter());

    switch (Settings::viewMode())
    {
        case CombinedView:
            slotCombinedView();
            break;
        case WidescreenView:
            slotWidescreenView();
            break;
        default:
            slotNormalView();
    }

    m_articles->hide();
    m_searchBar->hide();
    m_articleViewer->displayAboutPage();
    m_tabs->setTitle(i18n("About"), m_mainTab);
    m_displayingAboutPage = true;
    
    m_fetchTimer=new QTimer(this);
    connect( m_fetchTimer, SIGNAL(timeout()), this, SLOT(slotDoIntervalFetches()) );
    m_fetchTimer->start(1000*60);

    // delete expired articles once per hour
    m_expiryTimer = new QTimer(this);
    connect(m_expiryTimer, SIGNAL(timeout()), this,
            SLOT(slotDeleteExpiredArticles()) );
    m_expiryTimer->start(3600*1000);

    QTimer::singleShot(0, this, SLOT(delayedInit()));
}


Generated by  Doxygen 1.6.0   Back to index