summaryrefslogtreecommitdiff
path: root/libopie2/opieui/olistview.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opieui/olistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/olistview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp
index 0ee2fde..38670b4 100644
--- a/libopie2/opieui/olistview.cpp
+++ b/libopie2/opieui/olistview.cpp
@@ -1,86 +1,91 @@
/*
                This file is part of the Opie Project
=. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de>
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program 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.
*/
/* QT */
#include <qpixmap.h>
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/olistview.h>
+using namespace Opie::Core;
+
+
+namespace Opie {
+namespace Ui {
/*======================================================================================
* OListView
*======================================================================================*/
OListView::OListView( QWidget *parent, const char *name )
:QListView( parent, name )
{
//FIXME: get from global settings and calculate ==> see oglobalsettings.*
m_alternateBackground = QColor( 238, 246, 255 );
m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine );
m_fullWidth = true;
connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
}
OListView::~OListView()
{
}
void OListView::setFullWidth( bool fullWidth )
{
m_fullWidth = m_fullWidth;
#if QT_VERSION > 290
header()->setStretchEnabled( fullWidth, columns()-1 );
#endif
}
bool OListView::fullWidth() const
{
return m_fullWidth;
}
int OListView::addColumn( const QString& label, int width )
{
int result = QListView::addColumn( label, width );
#if QT_VERSION > 290
if (m_fullWidth) {
header()->setStretchEnabled( false, columns()-2 );
header()->setStretchEnabled( true, columns()-1 );
}
#endif
return result;
}
int OListView::addColumn( const QIconSet& iconset, const QString& label, int width )
{
int result = QListView::addColumn( iconset, label, width );
#if QT_VERSION > 290
@@ -710,48 +715,50 @@ ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* af
}
ONamedListViewItem::~ONamedListViewItem()
{
}
void ONamedListViewItem::setText( const QStringList& texts )
{
int col = 0;
for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it )
{
qDebug( "setting column %d = text %s", col, (const char*) *it );
OListViewItem::setText( col++, *it );
}
}
void ONamedListViewItem::setText( const QString& column, const QString& text )
{
//FIXME: If used excessively, this will slow down performance of updates
//FIXME: because of the linear search over all column texts.
//FIXME: I will optimize later by using a hash map.
int col = ( (ONamedListView*) listView() )->findColumn( column );
if ( col != -1 )
OListViewItem::setText( col, text );
else
qWarning( "ONamedListViewItem::setText(): Warning! Columntext '%s' not found.", (const char*) column );
}
ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const
{
return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse );
}
ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const
{
int col = ( (ONamedListView*) listView() )->findColumn( column );
if ( col != -1 )
return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse );
else
return 0;
}
+}
+}