summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-22 03:17:57 (UTC)
committer ulf69 <ulf69>2004-10-22 03:17:57 (UTC)
commitd7ca0e5ca1346116145209b49ae62abeefebdb5f (patch) (side-by-side diff)
tree29080282472aa29ebe3a8ebd4e47837e18e0b51b
parente81c11b59475d934608c7253d2862933d497d1f8 (diff)
downloadkdepimpi-d7ca0e5ca1346116145209b49ae62abeefebdb5f.zip
kdepimpi-d7ca0e5ca1346116145209b49ae62abeefebdb5f.tar.gz
kdepimpi-d7ca0e5ca1346116145209b49ae62abeefebdb5f.tar.bz2
added include statement to make it buildable on all systems
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kjanuswidget.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/microkde/kdeui/kjanuswidget.cpp b/microkde/kdeui/kjanuswidget.cpp
index 7d25854..462c44f 100644
--- a/microkde/kdeui/kjanuswidget.cpp
+++ b/microkde/kdeui/kjanuswidget.cpp
@@ -1,129 +1,129 @@
/* This file is part of the KDE Libraries
* Copyright (C) 1999-2000 Espen Sand (espensa@online.no)
* Copyright (C) 2003 Ravikiran Rajagopal (ravi@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <qpixmap.h>
#include <qbitmap.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwidgetstack.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qgrid.h>
#include <qpainter.h>
#include <qobjectlist.h>
-
+#include <qstringlist.h>
/*US
#include <qbitmap.h>
#include <qgrid.h>
#include <qhbox.h>
#include <qheader.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qobjectlist.h>
#include <qpixmap.h>
#include <qsplitter.h>
#include <qtabwidget.h>
#include <qvbox.h>
#include <qwidgetstack.h>
#include <qpainter.h>
#include <qstyle.h>
#include <kapplication.h>
#include <klocale.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kseparator.h>
#include <kdebug.h>
#include "kjanuswidget.h"
#include <klistview.h>
*/
#include <kseparator.h>
#include <kdialog.h> // Access to some static members
#include <kdebug.h>
#include <klistview.h>
#include "kjanuswidget.h"
class KJanusWidget::IconListItem : public QListBoxItem
{
public:
IconListItem( QListBox *listbox, const QPixmap &pixmap,
const QString &text );
virtual int height( const QListBox *lb ) const;
virtual int width( const QListBox *lb ) const;
int expandMinimumWidth( int width );
protected:
const QPixmap &defaultPixmap();
void paint( QPainter *painter );
private:
QPixmap mPixmap;
int mMinimumWidth;
};
class KJanusWidget::KJanusWidgetPrivate
{
public:
KJanusWidgetPrivate() : mNextPageIndex(0) { }
int mNextPageIndex; // The next page index.
// Dictionary for multipage modes.
QMap<int,QWidget*> mIntToPage;
// Reverse dictionary. Used because showPage() may be performance critical.
QMap<QWidget*,int> mPageToInt;
// Dictionary of title string associated with page.
QMap<int, QString> mIntToTitle;
};
template class QPtrList<QListViewItem>;
KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face )
: QWidget( parent, name ),
mValid(false), mPageList(0),
mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0),
mShowIconsInTreeList(false), d(0)
{
QVBoxLayout *topLayout = new QVBoxLayout( this );
if( mFace == TreeList || mFace == IconList )
{
d = new KJanusWidgetPrivate;
QFrame *page = 0;
if( mFace == TreeList )
{
//US
qDebug("KJanusWidget::KJanusWidget TreeList not implemented yet");
/*US
QSplitter *splitter = new QSplitter( this );
topLayout->addWidget( splitter, 10 );
mTreeListResizeMode = QSplitter::KeepSize;
mTreeList = new KListView( splitter );
mTreeList->addColumn( QString::null );
mTreeList->header()->hide();
mTreeList->setRootIsDecorated(true);
mTreeList->setSorting( -1 );
@@ -203,192 +203,193 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face )
topLayout->addWidget( mPlainPage, 10 );
}
/*US
if ( kapp )
connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged()));
*/
mValid = true;
setSwallowedWidget(0); // Set default size if 'mFace' is Swallow.
}
KJanusWidget::~KJanusWidget()
{
/*US the destroyed signal caused a segmentation fault while closing the dialog and destructing
all pages. Why not just remove all pages in the destructor??
*/
// LR we have all subwidgets with parent-child relation
// LR we do not need to delete here anything by the private class
/*
if( mFace == Tabbed )
{
QMap<QWidget*,int>::Iterator it;
for (it = d->mPageToInt.begin(); it != d->mPageToInt.end(); ++it) {
QObject*page = (QObject*)it.key();
pageGone(page);
}
}
else
qDebug("KJanusWidget::~KJanusWidget so far ");
*/
//US end
delete d;
}
bool KJanusWidget::isValid() const
{
return( mValid );
}
QFrame *KJanusWidget::plainPage()
{
return( mPlainPage );
}
int KJanusWidget::face() const
{
return( mFace );
}
QWidget *KJanusWidget::FindParent()
{
if( mFace == Tabbed ) {
return mTabControl;
}
else {
return this;
}
}
QFrame *KJanusWidget::addPage( const QStringList &items, const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
QFrame *page = new QFrame( FindParent(), "page" );
addPageWidget( page, items, header, pixmap );
return page;
}
void KJanusWidget::pageGone( QObject *obj )
{
// QObject* obj = (QObject*)sender();
removePage( static_cast<QWidget*>( obj ) );
}
void KJanusWidget::slotReopen( QListViewItem * item )
{
if( item )
item->setOpen( true );
}
QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header,
const QPixmap &pixmap )
{
+
QStringList items;
items << itemName;
return addPage(items, header, pixmap);
}
QVBox *KJanusWidget::addVBoxPage( const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
qDebug("addPage: Invalid object ");
return( 0 );
}
QVBox *page = new QVBox(FindParent() , "vbox_page" );
page->setSpacing( KDialog::spacingHintSmall() );
addPageWidget( page, items, header, pixmap );
return page;
}
QVBox *KJanusWidget::addVBoxPage( const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addVBoxPage(items, header, pixmap);
}
QHBox *KJanusWidget::addHBoxPage( const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false ) {
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
QHBox *page = new QHBox(FindParent(), "hbox_page");
page->setSpacing( KDialog::spacingHint() );
addPageWidget( page, items, header, pixmap );
return page;
}
QHBox *KJanusWidget::addHBoxPage( const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addHBoxPage(items, header, pixmap);
}
QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir,
const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
QGrid *page = new QGrid( n, dir, FindParent(), "page" );
page->setSpacing( KDialog::spacingHint() );
addPageWidget( page, items, header, pixmap );
return page;
}
QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir,
const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addGridPage(n, dir, items, header, pixmap);
}
void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page)
{
bool isTop = true;
QListViewItem *curTop = 0, *child, *last, *newChild;
unsigned int index = 1;
QStringList curPath;
for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) {