summaryrefslogtreecommitdiff
path: root/libopie2/qt3/opieui/ojanuswidget.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/qt3/opieui/ojanuswidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/qt3/opieui/ojanuswidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/qt3/opieui/ojanuswidget.cpp b/libopie2/qt3/opieui/ojanuswidget.cpp
index 063e393..8bdbc03 100644
--- a/libopie2/qt3/opieui/ojanuswidget.cpp
+++ b/libopie2/qt3/opieui/ojanuswidget.cpp
@@ -647,257 +647,257 @@ bool OJanusWidget::showPage( QWidget *w )
return( true );
}
int OJanusWidget::activePageIndex() const
{
if( mFace == TreeList) {
QListViewItem *node = mTreeList->selectedItem();
if( node == 0 ) { return -1; }
QWidget *stackItem = mTreeListToPageStack[node];
return mPageList->findRef(stackItem);
}
else if (mFace == IconList) {
QListBoxItem *node = mIconList->item( mIconList->currentItem() );
if( node == 0 ) { return( false ); }
QWidget *stackItem = mIconListToPageStack[node];
return mPageList->findRef(stackItem);
}
else if( mFace == Tabbed ) {
QWidget *widget = mTabControl->currentPage();
return( widget == 0 ? -1 : mPageList->findRef( widget ) );
}
else {
return( -1 );
}
}
int OJanusWidget::pageIndex( QWidget *widget ) const
{
if( widget == 0 )
{
return( -1 );
}
else if( mFace == TreeList || mFace == IconList )
{
return( mPageList->findRef( widget ) );
}
else if( mFace == Tabbed )
{
//
// The user gets the real page widget with addVBoxPage(), addHBoxPage()
// and addGridPage() but not with addPage() which returns a child of
// the toplevel page. addPage() returns a QFrame so I check for that.
//
if( widget->isA("QFrame") )
{
return( mPageList->findRef( widget->parentWidget() ) );
}
else
{
return( mPageList->findRef( widget ) );
}
}
else
{
return( -1 );
}
}
void OJanusWidget::slotFontChanged()
{
#ifdef FIXME
if ( mTitleLabel != 0 )
{
mTitleLabel->setFont( KGlobalSettings::generalFont() );
QFont titleFont( mTitleLabel->font() );
titleFont.setBold( true );
mTitleLabel->setFont( titleFont );
}
#endif
if( mFace == IconList )
{
QFont listFont( mIconList->font() );
listFont.setBold( true );
mIconList->setFont( listFont );
mIconList->invalidateHeight();
mIconList->invalidateWidth();
}
}
// makes the treelist behave like the list of kcontrol
void OJanusWidget::slotItemClicked(QListViewItem *it)
{
if(it && (it->childCount()>0))
it->setOpen(!it->isOpen());
}
void OJanusWidget::setFocus()
{
if( mValid == false ) { return; }
if( mFace == TreeList )
{
mTreeList->setFocus();
}
if( mFace == IconList )
{
mIconList->setFocus();
}
else if( mFace == Tabbed )
{
mTabControl->setFocus();
}
else if( mFace == Swallow )
{
mSwallowPage->setFocus();
}
else if( mFace == Plain )
{
mPlainPage->setFocus();
}
}
QSize OJanusWidget::minimumSizeHint() const
{
if( mFace == TreeList || mFace == IconList )
{
QSize s1( ODialog::spacingHint(), ODialog::spacingHint()*2 );
QSize s2(0,0);
QSize s3(0,0);
QSize s4( mPageStack->sizeHint() );
if( mFace == TreeList )
{
-#if QT_VERSION < 300
+#if QT_VERSION < 0x030000
s1.rwidth() += style().splitterWidth();
#else
s1.rwidth() += style().pixelMetric( QStyle::PM_SplitterWidth );
#endif
s2 = mTreeList->minimumSize();
}
else
{
mIconList->updateMinimumHeight();
mIconList->updateWidth();
s2 = mIconList->minimumSize();
}
if( mTitleLabel->isVisible() == true )
{
s3 += mTitleLabel->sizeHint();
s3.rheight() += mTitleSep->minimumSize().height();
}
//
// Select the tallest item. It has only effect in IconList mode
//
int h1 = s1.rheight() + s3.rheight() + s4.height();
int h2 = QMAX( h1, s2.rheight() );
return( QSize( s1.width()+s2.width()+QMAX(s3.width(),s4.width()), h2 ) );
}
else if( mFace == Tabbed )
{
return( mTabControl->sizeHint() );
}
else if( mFace == Swallow )
{
return( mSwallowPage->minimumSize() );
}
else if( mFace == Plain )
{
return( mPlainPage->sizeHint() );
}
else
{
return( QSize( 100, 100 ) ); // Should never happen though.
}
}
QSize OJanusWidget::sizeHint() const
{
return( minimumSizeHint() );
}
void OJanusWidget::setTreeListAutoResize( bool state )
{
if( mFace == TreeList )
{
mTreeListResizeMode = state == false ?
QSplitter::KeepSize : QSplitter::Stretch;
QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
splitter->setResizeMode( mTreeList, mTreeListResizeMode );
}
}
void OJanusWidget::setIconListAllVisible( bool state )
{
if( mFace == IconList )
{
mIconList->setShowAll( state );
}
}
void OJanusWidget::setShowIconsInTreeList( bool state )
{
mShowIconsInTreeList = state;
}
void OJanusWidget::setRootIsDecorated( bool state )
{
if( mFace == TreeList ) {
mTreeList->setRootIsDecorated(state);
}
}
void OJanusWidget::unfoldTreeList( bool persist )
{
if( mFace == TreeList )
{
if( persist )
connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
else
disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
item->setOpen( true );
}
}
void OJanusWidget::showEvent( QShowEvent * )
{
if( mFace == TreeList )
{
QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
splitter->setResizeMode( mTreeList, mTreeListResizeMode );
}
}
//
// 2000-13-02 Espen Sand
// It should be obvious that this eventfilter must only be
// be installed on the vertical scrollbar of the mIconList.
//
bool OJanusWidget::eventFilter( QObject *o, QEvent *e )
{
if( e->type() == QEvent::Show )
{
IconListItem *item = (IconListItem*)mIconList->item(0);
if( item != 0 )
{
int lw = item->width( mIconList );
int sw = mIconList->verticalScrollBar()->sizeHint().width();
mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 );
}
}
else if( e->type() == QEvent::Hide )
{