Commit 67153b10 authored by R. Harish Navnit's avatar R. Harish Navnit Committed by Pali Rohár

Remove all KDE3/Qt3 occurences from libkopete

parent f2ca98e8
......@@ -152,7 +152,15 @@ kde4_add_kcfg_files(kopete_LIB_SRCS GENERATE_MOC
kde4_add_library(kopete SHARED ${kopete_LIB_SRCS})
target_link_libraries(kopete ${KDE4_KEMOTICONS_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KABC_LIBS} ${KDE4_SOLID_LIBS})
target_link_libraries(kopete
${QT_QTXML_LIBRARIES}
${KDE4_KIO_LIBS}
${KDE4_KABC_LIBS}
${KDE4_SOLID_LIBS}
${KDE4_KCMUTILS_LIBS}
${KDE4_KEMOTICONS_LIBS}
)
if(NOT DISABLE_VIDEOSUPPORT)
target_link_libraries(kopete kopete_videodevice)
endif(NOT DISABLE_VIDEOSUPPORT)
......
......@@ -18,18 +18,22 @@
#include "addressbookselectordialog.h"
#include "addressbookselectorwidget.h"
#include <qdialog.h>
#include <q3listview.h>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <kvbox.h>
#include <klocale.h>
#include <kdialog.h>
#include <ktreewidgetsearchline.h>
namespace Kopete
{
namespace UI
{
AddressBookSelectorDialog::AddressBookSelectorDialog(const QString &title, const QString &message, const QString &preSelectUid, QWidget *parent )
AddressBookSelectorDialog::AddressBookSelectorDialog(const QString &title, const QString &message, const QString &preSelectUid, QWidget *parent )
: KDialog( parent )
{
setCaption( title );
......@@ -46,7 +50,7 @@ AddressBookSelectorDialog::AddressBookSelectorDialog(const QString &title, const
enableButtonOk(false);
//setHelp("linkaddressbook");
setHelp(QString(), "kopete");
connect(m_addressBookSelectorWidget, SIGNAL(addresseeListClicked(Q3ListViewItem*)), SLOT(slotWidgetAddresseeListClicked(Q3ListViewItem*)));
connect(m_addressBookSelectorWidget, SIGNAL(addresseeListClicked(QTreeWidgetItem*)), SLOT(slotWidgetAddresseeListClicked(QTreeWidgetItem*)));
if ( !preSelectUid.isEmpty() )
m_addressBookSelectorWidget->selectAddressee(preSelectUid);
......@@ -70,7 +74,7 @@ KABC::Addressee AddressBookSelectorDialog::getAddressee( const QString &title, c
return adr;
}
void AddressBookSelectorDialog::slotWidgetAddresseeListClicked( Q3ListViewItem *addressee )
void AddressBookSelectorDialog::slotWidgetAddresseeListClicked( QTreeWidgetItem *addressee )
{
// enable ok if a valid addressee is selected
enableButtonOk( addressee ? addressee->isSelected() : false);
......
......@@ -22,8 +22,10 @@
#include <kdemacros.h>
#include "kopete_export.h"
#include <kdialog.h>
#include <ktreewidgetsearchline.h>
#include <Qt3Support/Q3ListView>
#include <QTreeWidget>
#include <QTreeWidgetItem>
namespace KABC
{
......@@ -80,7 +82,7 @@ public:
protected slots:
virtual void accept();
virtual void reject();
void slotWidgetAddresseeListClicked( Q3ListViewItem *addressee );
void slotWidgetAddresseeListClicked( QTreeWidgetItem *addressee );
protected:
AddressBookSelectorWidget *m_addressBookSelectorWidget;
};
......
......@@ -26,7 +26,6 @@
*/
#include "addressbookselectorwidget.h"
#include <qcheckbox.h>
#include <kconfig.h>
#include <klocale.h>
#include <kiconloader.h>
......@@ -36,9 +35,12 @@
#include <kpushbutton.h>
#include <kdebug.h>
#include <k3listview.h>
#include <k3listviewsearchline.h>
#include <ktreewidgetsearchline.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <QHeaderView>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <addresseeitem.h>
......@@ -63,23 +65,26 @@ AddressBookSelectorWidget::AddressBookSelectorWidget( QWidget *parent, const cha
connect( addAddresseeButton, SIGNAL(clicked()), SLOT(slotAddAddresseeClicked()) );
connect( addAddresseeButton, SIGNAL(clicked()), SIGNAL(addAddresseeClicked()) );
connect( addresseeListView, SIGNAL(clicked(Q3ListViewItem*)),
SIGNAL(addresseeListClicked(Q3ListViewItem*)) );
connect( addresseeListView, SIGNAL(selectionChanged(Q3ListViewItem*)),
SIGNAL(addresseeListClicked(Q3ListViewItem*)) );
connect( addresseeListView, SIGNAL(spacePressed(Q3ListViewItem*)),
SIGNAL(addresseeListClicked(Q3ListViewItem*)) );
connect( addresseeListView, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
SIGNAL(addresseeListClicked(QTreeWidgetItem*)) );
connect( addresseeListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
SIGNAL(addresseeListClicked(QTreeWidgetItem*)) );
//FIXME: Find the correct replacement for Q3ListView::spacePressed(Q3ListViewItem*)
connect( addresseeListView, SIGNAL(itemPressed(QTreeWidgetItem*,int)),
SIGNAL(addresseeListClicked(QTreeWidgetItem*)) );
connect( m_addressBook, SIGNAL(addressBookChanged(AddressBook*)), this, SLOT(slotLoadAddressees()) );
//We should add a clear KAction here. But we can't really do that with a designer file :\ this sucks
addresseeListView->setColumnText(2, KIcon(QLatin1String("internet-mail")), i18n("Email"));
addresseeListView->header()->setResizeMode(QHeaderView::ResizeToContents);
addresseeListView->currentItem()->setIcon(2, QIcon(QLatin1String("internet-mail")));
addresseeListView->currentItem()->setText(2, i18n("Email"));
kListViewSearchLine->setListView(addresseeListView);
kListViewSearchLine->setTreeWidget(addresseeListView);
slotLoadAddressees();
addresseeListView->setColumnWidthMode(0, Q3ListView::Manual);
addresseeListView->header()->setResizeMode(QHeaderView::ResizeToContents);
addresseeListView->setColumnWidth(0, 63); //Photo is 60, and it's nice to have a small gap, imho
}
......@@ -93,7 +98,7 @@ AddressBookSelectorWidget::~AddressBookSelectorWidget()
KABC::Addressee AddressBookSelectorWidget::addressee()
{
AddresseeItem *item = 0L;
item = static_cast<AddresseeItem *>( addresseeListView->selectedItem() );
item = static_cast<AddresseeItem *>( addresseeListView->currentItem() );
if ( item )
m_addressee = item->addressee();
......@@ -104,15 +109,15 @@ KABC::Addressee AddressBookSelectorWidget::addressee()
void AddressBookSelectorWidget::selectAddressee( const QString &uid )
{
// iterate trough list view
Q3ListViewItemIterator it( addresseeListView );
while( it.current() )
QTreeWidgetItemIterator it( addresseeListView );
while( (*it) )
{
AddresseeItem *addrItem = (AddresseeItem *) it.current();
AddresseeItem *addrItem = (AddresseeItem *) ( (*it) );
if ( addrItem->addressee().uid() == uid )
{
// select the contact item
addresseeListView->setSelected( addrItem, true );
addresseeListView->ensureItemVisible( addrItem );
addrItem->setSelected( true );
addresseeListView->scrollToItem( addrItem, QAbstractItemView::EnsureVisible );
}
++it;
}
......@@ -120,7 +125,7 @@ void AddressBookSelectorWidget::selectAddressee( const QString &uid )
bool AddressBookSelectorWidget::addresseeSelected()
{
return addresseeListView->selectedItem() ? true : false;
return addresseeListView->currentItem() ? true : false;
}
/** Read in contacts from addressbook, and select the contact that is for our nick. */
......@@ -154,13 +159,16 @@ void AddressBookSelectorWidget::slotAddAddresseeClicked()
Kopete::KABCPersistence::self()->writeAddressBook( 0 );
slotLoadAddressees();
// select the addressee we just added
Q3ListViewItem * added = addresseeListView->findItem( addresseeName, 1 );
QList<QTreeWidgetItem *> added = addresseeListView->findItems( addresseeName, 0, 1 );
foreach(QTreeWidgetItem *wi, added) {
wi->setSelected( true );
addresseeListView->scrollToItem(wi, QAbstractItemView::EnsureVisible);
}
kListViewSearchLine->clear();
kListViewSearchLine->updateSearch();
kListViewSearchLine->clear();
kListViewSearchLine->updateSearch();
addresseeListView->setSelected( added, true );
addresseeListView->ensureItemVisible( added );
//addresseeListView->scrollToItem( added, 0 );
}
}
......
......@@ -77,7 +77,7 @@ protected slots:
*/
void slotLoadAddressees();
signals:
void addresseeListClicked( Q3ListViewItem *addressee );
void addresseeListClicked( QTreeWidgetItem *addressee );
void addAddresseeClicked();
};
......
......@@ -74,7 +74,7 @@
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="K3ListView" name="addresseeListView" >
<widget class="QTreeWidget" name="addresseeListView" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
......@@ -87,9 +87,6 @@
<property name="allColumnsShowFocus" >
<bool>true</bool>
</property>
<property name="resizeMode" >
<enum>Q3ListView::LastColumn</enum>
</property>
<column>
<property name="text" >
<string>Photo</string>
......@@ -141,31 +138,16 @@
</widget>
</item>
<item>
<widget class="K3ListViewSearchLine" native="1" name="kListViewSearchLine" />
<widget class="KTreeWidgetSearchLine" native="1" name="kListViewSearchLine" />
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>K3ListView</class>
<extends>Q3ListView</extends>
<header>k3listview.h</header>
</customwidget>
<customwidget>
<class>K3ListViewSearchLine</class>
<extends></extends>
<header>k3listviewsearchline.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>addresseeListView</tabstop>
<tabstop>addAddresseeButton</tabstop>
</tabstops>
<includes>
<include location="global" >k3listviewsearchline.h</include>
</includes>
<resources/>
<connections/>
</ui>
......@@ -24,12 +24,13 @@
#include <q3groupbox.h>
#include <qregexp.h>
#include <QPixmap>
#include <QIcon>
#include <klocale.h>
#include <kdebug.h>
AddresseeItem::AddresseeItem( Q3ListView *parent, const KABC::Addressee &addressee) :
K3ListViewItem( parent ),
AddresseeItem::AddresseeItem( QTreeWidget *parent, const KABC::Addressee &addressee) :
QTreeWidgetItem( parent ),
mAddressee( addressee )
{
//We can't save showphoto because we don't have a d pointer
......@@ -39,7 +40,7 @@ AddresseeItem::AddresseeItem( Q3ListView *parent, const KABC::Addressee &address
if(pic.isIntern())
{
QPixmap qpixmap = QPixmap::fromImage( pic.data().scaledToWidth(60) ); //60 pixels seems okay.. kmail uses 60 btw
setPixmap( Photo,qpixmap );
setIcon(Photo, QIcon(qpixmap));
}
setText( Name, addressee.realName() );
......
......@@ -22,14 +22,14 @@
#define ADDRESSEEITEM_H
#include <klineedit.h>
#include <k3listview.h>
#include <QTreeWidget>
#include <kabc/addressbook.h>
/**
@short Special ListViewItem
*/
class AddresseeItem : public K3ListViewItem
class AddresseeItem : public QTreeWidgetItem
{
public:
......@@ -46,7 +46,7 @@ class AddresseeItem : public K3ListViewItem
@param parent The parent listview.
@param addressee The associated addressee.
*/
AddresseeItem( Q3ListView *parent, const KABC::Addressee &addressee );
AddresseeItem( QTreeWidget *parent, const KABC::Addressee &addressee );
/**
Returns the addressee.
......
This diff is collapsed.
......@@ -19,7 +19,7 @@
#ifndef KOPETE_LISTVIEW_H
#define KOPETE_LISTVIEW_H
#include <k3listview.h>
#include <QTreeWidget>
#include <kopete_export.h>
class QKeyEvent;
......@@ -34,7 +34,7 @@ namespace ListView {
* @author Engin AYDOGAN <engin@bzzzt.biz>
* @author Richard Smith <kde@metafoo.co.uk>
*/
class KOPETE_EXPORT ListView : public K3ListView
class KOPETE_EXPORT ListView : public QTreeWidget
{
Q_OBJECT
......@@ -132,7 +132,7 @@ public slots:
/**
* Calls QListView::sort()
*/
void slotSort() { sort(); }
void slotSort() { sortItems(currentColumn(), Qt::AscendingOrder); }
protected:
virtual void keyPressEvent( QKeyEvent *e );
......@@ -152,8 +152,8 @@ signals:
void visibleSizeChanged ();
private slots:
void slotContextMenu(K3ListView*,Q3ListViewItem *item, const QPoint &point );
void slotDoubleClicked( Q3ListViewItem *item );
void slotContextMenu(QTreeWidget*,QTreeWidgetItem *item, const QPoint &point );
void slotDoubleClicked( QTreeWidgetItem *item );
/**
* To enable smooth scroll to focus on highlighted items when they are highlighted
* by a key press we use this slot. slotCurrentChanged is connected to the currentChanged
......@@ -161,7 +161,7 @@ private slots:
* by the mouse, then we don't do anything, since the item is on the viewable area already.
* Otherwise, we focus (bring it to the center of the list) smoothly.
*/
void slotCurrentChanged( Q3ListViewItem *item );
void slotCurrentChanged( QTreeWidgetItem *item );
private:
class Private;
......
......@@ -30,10 +30,10 @@
#include <qpainter.h>
#include <qrect.h>
#include <qtimer.h>
#include <q3header.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <QList>
#include <QHeaderView>
#include <limits.h>
......@@ -955,14 +955,14 @@ bool Item::Private::animateChanges = true;
bool Item::Private::fadeVisibility = true;
bool Item::Private::foldVisibility = true;
Item::Item( Q3ListViewItem *parent, QObject *owner )
: QObject( owner ), K3ListViewItem( parent ), d( new Private(this) )
Item::Item( QTreeWidgetItem *parent, QObject *owner )
: QObject( owner ), QTreeWidgetItem( parent ), d( new Private(this) )
{
initLVI(parent->listView());
initLVI(parent->treeWidget());
}
Item::Item( Q3ListView *parent, QObject *owner )
: QObject( owner ), K3ListViewItem( parent ), d( new Private(this) )
Item::Item( QTreeWidget *parent, QObject *owner )
: QObject( owner ), QTreeWidgetItem( parent ), d( new Private(this) )
{
initLVI(parent);
}
......@@ -981,7 +981,7 @@ void Item::setEffects( bool animation, bool fading, bool folding )
void Item::initLVI(QObject* parent)
{
connect( listView()->header(), SIGNAL(sizeChange(int,int,int)), SLOT(slotColumnResized()) );
connect( treeWidget()->header(), SIGNAL(sectionResized(int,int,int)), SLOT(slotColumnResized()) );
connect( &d->layoutTimer, SIGNAL(timeout()), SLOT(slotLayoutItems()) );
connect (this, SIGNAL (visibilityChanged(bool)), parent, SIGNAL (visibleSizeChanged()) );
//connect( &d->layoutAnimateTimer, SIGNAL(timeout()), SLOT(slotLayoutAnimateItems()) );
......@@ -1013,11 +1013,11 @@ void Item::slotLayoutItems()
for ( uint n = 0; n < components(); ++n )
{
int width = listView()->columnWidth(n);
int width = treeWidget()->columnWidth(n);
if ( n == 0 )
{
int d = depth() + (listView()->rootIsDecorated() ? 1 : 0);
width -= d * listView()->treeStepSize();
int d = depth() + (treeWidget()->rootIsDecorated() ? 1 : 0);
width -= d * treeWidget()->indentation();
}
int height = component( n )->heightForWidth( width );
......@@ -1139,7 +1139,7 @@ void Item::repaint()
// if we're about to relayout, don't bother painting yet.
if ( d->layoutTimer.isActive() )
return;
listView()->repaintItem( this );
this->treeWidget()->update();
}
void Item::relayout()
......@@ -1149,7 +1149,8 @@ void Item::relayout()
void Item::setup()
{
K3ListViewItem::setup();
//FIXME:
//QTreeWidgetItem::setup();
slotLayoutItems();
}
......@@ -1166,32 +1167,45 @@ void Item::setHeight( int )
vis = Private::visibilityFoldSteps;
minHeight = (minHeight * vis) / Private::visibilityFoldSteps;
}
K3ListViewItem::setHeight( minHeight );
this->setHeight( minHeight );
}
int Item::width( const QFontMetrics &, const Q3ListView *lv, int c ) const
int Item::width( const QFontMetrics &, const QTreeWidget *lv, int c ) const
{
// Qt computes the itemRect from this. we want the whole item to be
// clickable, so we return the widest we could possibly be.
return lv->header()->sectionSize( c );
}
void Item::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
int Item::depth( ) const
{
int itemDepth = 0;
QTreeWidgetItem *item = this->treeWidget()->currentItem();
while(item->parent() != 0) {
++itemDepth;
item = item->parent();
}
return itemDepth;
}
void Item::paintCell( QPainter *p, const QPalette &cg, int column, int width, int align )
{
Q_UNUSED(align);
QPixmap back( width, height() );
QPixmap back( width, treeWidget()->height() );
QPainter paint( &back );
//K3ListViewItem::paintCell( &paint, cg, column, width, align );
//QTreeWidgetItem::paintCell( &paint, cg, column, width, align );
// PASTED FROM KLISTVIEWITEM:
// set the alternate cell background colour if necessary
QColorGroup _cg = cg;
_cg.setColor( listView()->backgroundRole(), backgroundColor(column) );
_cg.setColor( treeWidget()->backgroundRole(), backgroundColor(column) );
// PASTED FROM QLISTVIEWITEM
{
QPainter *p = &paint;
Q3ListView *lv = listView();
QTreeWidget *lv = treeWidget();
if ( !lv )
return;
QFontMetrics fm( p->fontMetrics() );
......@@ -1201,13 +1215,13 @@ void Item::paintCell( QPainter *p, const QColorGroup &cg, int column, int width,
// removed text truncating code from Qt - we do that differently, further on
int marg = lv->itemMargin();
int marg = lv->autoScrollMargin();
QBrush b;
if (isSelected())
b = _cg.brush(QPalette::Normal, QPalette::Highlight);
else
b = _cg.background();
p->fillRect( 0, 0, width, height(), b );
p->fillRect( 0, 0, width, treeWidget()->height(), b );
// const QPixmap * icon = pixmap( column );
#ifdef __GNUC__
#warning Item::paintCell needs fixing
......@@ -1227,9 +1241,9 @@ void Item::paintCell( QPainter *p, const QColorGroup &cg, int column, int width,
if ( lv->isEnabled() )
how |= QStyle::State_Enabled;
lv->style()->drawComplexControl( QStyle::CC_Q3ListView,
lv->style()->drawComplexControl( QStyle::CC_QTreeWidget,
p, lv, QRect( 0, 0, width, height() ), lv->colorGroup(),
how, QStyle::SC_Q3ListView, QStyle::SC_None,
how, QStyle::SC_QTreeWidget, QStyle::SC_None,
opt );
}
......@@ -1252,10 +1266,10 @@ void Item::paintCell( QPainter *p, const QColorGroup &cg, int column, int width,
textheight++;
if ( textheight < height() ) {
int w = lv->treeStepSize() / 2;
lv->style()->drawComplexControl( QStyle::CC_Q3ListView, p, lv,
lv->style()->drawComplexControl( QStyle::CC_QTreeWidget, p, lv,
QRect( 0, textheight, w + 1, height() - textheight + 1 ), _cg,
lv->isEnabled() ? QStyle::State_Enabled : QStyle::State_Default,
QStyle::SC_Q3ListViewExpand,
QStyle::SC_QTreeWidgetExpand,
(uint)QStyle::SC_All, QStyleOption( this ) );
}
}
......@@ -1314,7 +1328,7 @@ void Item::componentResized( Component *component )
void Item::mySetVisible ( bool b )
{
setVisible (b);
setHidden (!b);
emit visibilityChanged (b);
}
......
......@@ -19,7 +19,7 @@
#ifndef KOPETE_LISTVIEWITEM_H
#define KOPETE_LISTVIEWITEM_H
#include <k3listview.h>
#include <QTreeWidget>
#include <kopetecontact.h>
#include <kopete_export.h>
......@@ -393,19 +393,19 @@ public:
*
* @author Richard Smith <kde@metafoo.co.uk>
*/
class KOPETE_EXPORT Item : public QObject, public K3ListViewItem, public ComponentBase
class KOPETE_EXPORT Item : public QObject, public QTreeWidgetItem, public ComponentBase
{
Q_OBJECT
public:
explicit Item( Q3ListView *parent, QObject *owner = 0 );
explicit Item( Q3ListViewItem *parent, QObject *owner = 0 );
explicit Item( QTreeWidget *parent, QObject *owner = 0 );
explicit Item( QTreeWidgetItem *parent, QObject *owner = 0 );
~Item();
void repaint();
void relayout();
void setup();
virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align );
virtual void paintCell( QPainter *p, const QPalette &cg, int column, int width, int align );
//TODO: startRename(...)
float opacity();
......@@ -422,7 +422,8 @@ public:
*/
static void setEffects( bool animation, bool fading, bool folding );
int width( const QFontMetrics & fm, const Q3ListView * lv, int c ) const;
int width( const QFontMetrics & fm, const QTreeWidget * lv, int c ) const;
int depth( ) const;
/**
* Show or hide this item in a clean way depending on whether it matches
......
......@@ -25,7 +25,7 @@ namespace UI {
namespace ListView {
SearchLine::SearchLine( QWidget *parent, ListView *listView )
: K3ListViewSearchLine( parent, listView ), searchEmpty(true)
: KTreeWidgetSearchLine( parent, listView ), searchEmpty(true)
{
}
......@@ -41,7 +41,7 @@ void SearchLine::updateSearch( const QString &s )
// calls setVisible() on items with no way to customize this behaviour.
//BEGIN code from KSearchLine::updateSearch
if( !listView() )
if( !( this->treeWidget() ) )
return;
search = s.isNull() ? text() : s;
......@@ -50,58 +50,59 @@ void SearchLine::updateSearch( const QString &s )
// If there's a selected item that is visible, make sure that it's visible
// when the search changes too (assuming that it still matches).
Q3ListViewItem *currentItem = 0;
QTreeWidgetItem *currentItem = 0;
switch( listView()->selectionMode() )
switch( this->treeWidget()->selectionMode() )
{
case K3ListView::NoSelection:
case QTreeWidget::NoSelection:
break;
case K3ListView::Single:
currentItem = listView()->selectedItem();
case QTreeWidget::SingleSelection:
currentItem = this->treeWidget()->currentItem();
break;
default:
for( Q3ListViewItemIterator it(listView(), Q3ListViewItemIterator::Selected | Q3ListViewItemIterator::Visible);
it.current() && !currentItem; ++it )
for( QTreeWidgetItemIterator it(this->treeWidget(), QTreeWidgetItemIterator::Selected | QTreeWidgetItemIterator::NotHidden);
(*it) && !currentItem; ++it )
{
if( listView()->itemRect( it.current() ).isValid() )
currentItem = it.current();
if( this->treeWidget()->visualItemRect( (*it) ).isValid() )
currentItem = (*it);
}
}
if( keepParentsVisible() )
checkItemParentsVisible( listView()->firstChild() );
checkItemParentsVisible( this->treeWidget()->topLevelItem(0) );
else
checkItemParentsNotVisible();
if( currentItem )
listView()->ensureItemVisible( currentItem );
this->treeWidget()->scrollToItem( currentItem );
//END code from KSearchLine::updateSearch
}
void SearchLine::checkItemParentsNotVisible()
{
//BEGIN code from KSearchLine::checkItemParentsNotVisible
Q3ListViewItemIterator it( listView() );
for( ; it.current(); ++it )
QTreeWidgetItemIterator it( this->treeWidget() );
for( ; (*it); ++it )
{
Q3ListViewItem *item = it.current();
QTreeWidgetItem *item = (*it);
if( itemMatches( item, search ) )
setItemVisible( item, true );
this->setItemVisible( item, true );
else
setItemVisible( item, false );
this->setItemVisible( item, false );
}
//END code from KSearchLine::checkItemParentsNotVisible
}
bool SearchLine::checkItemParentsVisible( Q3ListViewItem *item )
bool SearchLine::checkItemParentsVisible( QTreeWidgetItem *item )
{
//BEGIN code from KSearchLine::checkItemParentsVisible
bool visible = false;
for( ; item; item = item->nextSibling() ) {
if( ( item->firstChild() && checkItemParentsVisible( item->firstChild() ) ) ||
QTreeWidgetItemIterator it(item);
for( ; (*it); ++it ) {
if( ( (*it)->child(0) && checkItemParentsVisible( (*it)->child(0) ) ) ||
itemMatches( item, search ) )
{
setItemVisible( item, true );
(*it)->setHidden( false );
// OUCH! this operation just became exponential-time.
// however, setting an item visible sets all its descendents
// visible too, which we definitely don't want.
......@@ -109,22 +110,22 @@ bool SearchLine::checkItemParentsVisible( Q3ListViewItem *item )
// so this really just doubles the runtime, if that.
// this still can be done in O(n) time by a mark-set process,