Logo Search packages:      
Sourcecode: d3lphin version File versions  Download package

void Dolphin::toggleSplitView (  )  [private, slot]

Switches between one and two views: If one view is visible, it will get split into two views. If already two views are visible, the nonactivated view gets closed.

Definition at line 796 of file dolphin.cpp.

References setActiveView().

Referenced by readProperties().

{
    if (m_view[SecondaryIdx] == 0) {
        const int newWidth = (m_view[PrimaryIdx]->width() - m_splitter->handleWidth()) / 2;

        // create a secondary view
        m_view[SecondaryIdx] = new DolphinView(m_splitter,
                                               m_view[PrimaryIdx]->url(),
                                               m_view[PrimaryIdx]->mode(),
                                               m_view[PrimaryIdx]->isShowHiddenFilesEnabled());

        QValueList<int> list = m_splitter->sizes();
        assert(!list.isEmpty());
        list.pop_back();
        list.append(newWidth);
        list.append(newWidth);
        m_splitter->setSizes(list);
        m_view[SecondaryIdx]->show();
        if(m_rightsidebar != 0){
            closerightSidebar();
            openrightSidebar();
        }
    }
    else {
        // remove secondary view
        if (m_activeView == m_view[PrimaryIdx]) {
            m_view[SecondaryIdx]->close();
            m_view[SecondaryIdx]->deleteLater();
            m_view[SecondaryIdx] = 0;
            setActiveView(m_view[PrimaryIdx]);
        }
        else {
            // The secondary view is active, hence from the users point of view
            // the content of the secondary view should be moved to the primary view.
            // From an implementation point of view it is more efficient to close
            // the primary view and exchange the internal pointers afterwards.
            m_view[PrimaryIdx]->close();
            m_view[PrimaryIdx]->deleteLater();
            m_view[PrimaryIdx] = m_view[SecondaryIdx];
            m_view[SecondaryIdx] = 0;
            setActiveView(m_view[PrimaryIdx]);
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index