[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krecipes] src: Delete obsolete list widgets.
From:       José_Manuel_Santamaría_Lema <panfaust () gmail ! com>
Date:       2016-04-08 12:47:47
Message-ID: E1aoVpD-0005cJ-6C () scm ! kde ! org
[Download RAW message or body]

Git commit 07bfff57a4eadd4ca8ca00044d6dadae89444d46 by José Manuel Santamaría Lema.
Committed on 08/04/2016 at 12:45.
Pushed by joselema into branch 'master'.

Delete obsolete list widgets.

We can't afford to delete them all yet.

M  +0    -6    src/CMakeLists.txt
M  +2    -2    src/actionshandlers/actionshandlerbase.cpp
M  +0    -1    src/dialogs/advancedsearchdialog.cpp
M  +1    -3    src/dialogs/unitsdialog.cpp
M  +2    -2    src/dialogs/unitsdialog.h
D  +0    -153  src/widgets/authorlistview.cpp
D  +0    -89   src/widgets/authorlistview.h
D  +0    -423  src/widgets/conversiontable.cpp
D  +0    -100  src/widgets/conversiontable.h
D  +0    -78   src/widgets/headerlistview.cpp
D  +0    -52   src/widgets/headerlistview.h
D  +0    -74   src/widgets/prepmethodlistview.cpp
D  +0    -50   src/widgets/prepmethodlistview.h
D  +0    -441  src/widgets/recipelistview.cpp
D  +0    -133  src/widgets/unitlistview.cpp
D  +0    -115  src/widgets/unitlistview.h

http://commits.kde.org/krecipes/07bfff57a4eadd4ca8ca00044d6dadae89444d46

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 02ddfd8..1a8681f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -118,16 +118,10 @@ set(krecipeswidgets_SRCS
    widgets/thumbbar.cpp
 
    #FIXME: The classes below are deprecated and must be removed sooner or later.
-   widgets/authorlistview.cpp #replaced by kreauthorlistwidget.cpp
    widgets/dblistviewbase.cpp #replaced by kregenericlistwidget.cpp
    widgets/categorylistview.cpp #replaced by krecategorieslistwidget.cpp
-   widgets/conversiontable.cpp #replaced by kreconversiontable.cpp
-   widgets/unitlistview.cpp #replaced by kreunitlistwidget.cpp
    widgets/propertylistview.cpp #replaced by krepropertylistwidget.cpp
-   widgets/prepmethodlistview.cpp #replaced by kreprepmethodlistwidget.cpp
    widgets/ingredientlistview.cpp #replaced by kreingredientlistwidget.cpp
-   widgets/headerlistview.cpp #replaced by kreheaderlistwidget.cpp
-   widgets/recipelistview.cpp
 
 )
 
diff --git a/src/actionshandlers/actionshandlerbase.cpp \
b/src/actionshandlers/actionshandlerbase.cpp index 0ec1296..b594240 100644
--- a/src/actionshandlers/actionshandlerbase.cpp
+++ b/src/actionshandlers/actionshandlerbase.cpp
@@ -18,12 +18,12 @@
 #include <KMessageBox>
 class Q3ListViewItem;
 
+#include "widgets/dblistviewbase.h"
+
 #include "datablocks/elementlist.h"
 
 #include "backends/recipedb.h"
 
-#include "widgets/authorlistview.h"
-
 #include "dialogs/createelementdialog.h"
 #include "dialogs/dependanciesdialog.h"
 
diff --git a/src/dialogs/advancedsearchdialog.cpp \
b/src/dialogs/advancedsearchdialog.cpp index cd88b5a..5e4f57e 100644
--- a/src/dialogs/advancedsearchdialog.cpp
+++ b/src/dialogs/advancedsearchdialog.cpp
@@ -51,7 +51,6 @@
 #include "backends/recipedb.h"
 #include "backends/searchparameters.h"
 #include "actionshandlers/recipeactionshandler.h"
-#include "widgets/recipelistview.h"
 #include "widgets/kdateedit.h"
 #include "widgets/fractioninput.h"
 #include "widgets/criteriacombobox.h"
diff --git a/src/dialogs/unitsdialog.cpp b/src/dialogs/unitsdialog.cpp
index 6a7a298..2c8579f 100644
--- a/src/dialogs/unitsdialog.cpp
+++ b/src/dialogs/unitsdialog.cpp
@@ -18,10 +18,8 @@
 #include "createelementdialog.h"
 #include "dependanciesdialog.h"
 #include "backends/recipedb.h"
-#include "widgets/conversiontable.h" //TODO: Remove, deprecated.
 #include "widgets/kreconversiontable.h"
-#include "widgets/unitlistview.h" //TODO: Remove, deprecated.
-#include "widgets/kreunitlistwidget.h" //TODO: Remove, deprecated.
+#include "widgets/kreunitlistwidget.h"
 #include "actionshandlers/kreunitactionshandler.h"
 
 #include <kapplication.h>
diff --git a/src/dialogs/unitsdialog.h b/src/dialogs/unitsdialog.h
index abefefa..03e97bb 100644
--- a/src/dialogs/unitsdialog.h
+++ b/src/dialogs/unitsdialog.h
@@ -11,8 +11,8 @@
 
 #ifndef UNITSDIALOG_H
 #define UNITSDIALOG_H
-#include <qwidget.h>
-#include <k3listview.h>
+
+#include <QWidget>
 
 #include "datablocks/unitratiolist.h"
 #include "datablocks/unit.h"
diff --git a/src/widgets/authorlistview.cpp b/src/widgets/authorlistview.cpp
deleted file mode 100644
index 21f3817..0000000
--- a/src/widgets/authorlistview.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#include "authorlistview.h"
-
-#include <kmessagebox.h>
-#include <kconfig.h>
-#include <klocale.h>
-#include <kglobal.h>
-#include <kmenu.h>
-#include <QList>
-#include <QPointer>
-
-#include "backends/recipedb.h"
-#include "dialogs/createelementdialog.h"
-#include "dialogs/dependanciesdialog.h"
-
-AuthorListView::AuthorListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( \
                parent, db, db->authorCount() )
-{
-	setAllColumnsShowFocus( true );
-	setDefaultRenameAction( Q3ListView::Reject );
-	connect( database, SIGNAL( authorCreated( const Element & ) ), SLOT( \
                checkCreateAuthor( const Element & ) ) );
-	connect( database, SIGNAL( authorRemoved( int ) ), SLOT( removeAuthor( int ) ) );
-}
-
-void AuthorListView::load( int limit, int offset )
-{
-	ElementList authorList;
-	database->loadAuthors( &authorList, limit, offset );
-
-	setTotalItems(authorList.count());
-
-	for ( ElementList::const_iterator ing_it = authorList.constBegin(); ing_it != \
                authorList.constEnd(); ++ing_it )
-		createAuthor( *ing_it );
-}
-
-void AuthorListView::checkCreateAuthor( const Element &el )
-{
-	if ( handleElement(el.name) ) { //only create this author if the base class okays \
                it
-		createAuthor(el);
-	}
-}
-
-
-StdAuthorListView::StdAuthorListView( QWidget *parent, RecipeDB *db, bool editable ) \
                : AuthorListView( parent, db )
-{
-	addColumn( i18nc( "@title:column", "Author" ) );
-
-	KConfigGroup config = KGlobal::config()->group( "Advanced" );
-	bool show_id = config.readEntry( "ShowID", false );
-	addColumn( i18nc( "@title:column", "Id" ) , show_id ? -1 : 0 );
-
-	if ( editable ) {
-		setRenameable( 0, true );
-	}
-}
-
-void StdAuthorListView::createAuthor( const Element &author )
-{
-	createElement(new Q3ListViewItem( this, author.name, QString::number( author.id ) \
                ));
-}
-
-void StdAuthorListView::removeAuthor( int id )
-{
-	Q3ListViewItem * item = findItem( QString::number( id ), 1 );
-	removeElement(item);
-}
-
-
-AuthorCheckListItem::AuthorCheckListItem( AuthorCheckListView* qlv, const Element \
                &author ) : Q3CheckListItem( qlv, QString(), \
                Q3CheckListItem::CheckBox ),
-	authorStored(author),
-	m_listview(qlv)
-{
-}
-
-AuthorCheckListItem::AuthorCheckListItem( AuthorCheckListView* qlv, Q3ListViewItem \
*after, const Element &author ) : Q3CheckListItem( qlv, after, QString(), \
                Q3CheckListItem::CheckBox ),
-	authorStored(author),
-	m_listview(qlv)
-{
-}
-
-Element AuthorCheckListItem::author() const
-{
-	return authorStored;
-}
-
-QString AuthorCheckListItem::text( int column ) const
-{
-	switch ( column ) {
-	case 0:
-		return ( authorStored.name );
-	case 1:
-		return ( QString::number( authorStored.id ) );
-	default:
-		return QString();
-	}
-}
-
-void AuthorCheckListItem::stateChange( bool on )
-{
-	m_listview->stateChange(this,on);
-}
-
-
-AuthorCheckListView::AuthorCheckListView( QWidget *parent, RecipeDB *db ) : \
                AuthorListView( parent, db )
-{
-	addColumn( i18nc( "@title:column", "Author" ) );
-
-	KConfigGroup config = KGlobal::config()->group( "Advanced" );
-	bool show_id = config.readEntry( "ShowID", false );
-	addColumn( i18nc( "@title:column", "Id" ) , show_id ? -1 : 0 );
-}
-
-void AuthorCheckListView::createAuthor( const Element &author )
-{
-	createElement(new AuthorCheckListItem( this, author ));
-}
-
-void AuthorCheckListView::removeAuthor( int id )
-{
-	Q3ListViewItem * item = findItem( QString::number( id ), 1 );
-	removeElement(item);
-}
-
-void AuthorCheckListView::load( int limit, int offset )
-{
-	AuthorListView::load(limit,offset);
-
-	for ( QList<Element>::const_iterator author_it = m_selections.constBegin(); \
                author_it != m_selections.constEnd(); ++author_it ) {
-		Q3CheckListItem * item = ( Q3CheckListItem* ) findItem( QString::number( \
                (*author_it).id ), 1 );
-		if ( item ) {
-			item->setOn(true);
-		}
-	}
-}
-
-void AuthorCheckListView::stateChange(AuthorCheckListItem *it,bool on)
-{
-	if ( !reloading() ) {
-		if ( on )
-			m_selections.append(it->author());
-		else
-			m_selections.removeAll(it->author());
-	}
-}
-
-#include "authorlistview.moc"
diff --git a/src/widgets/authorlistview.h b/src/widgets/authorlistview.h
deleted file mode 100644
index 7ee791c..0000000
--- a/src/widgets/authorlistview.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*   Copyright  © 2004 Unai Garro <ugarro@gmail.com>                        *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#ifndef AUTHORLISTVIEW_H
-#define AUTHORLISTVIEW_H
-
-#include "dblistviewbase.h"
-#include "datablocks/element.h"
-#include <QList>
-
-class RecipeDB;
-class KMenu;
-
-class AuthorCheckListView;
-
-class AuthorCheckListItem: public Q3CheckListItem
-{
-public:
-	AuthorCheckListItem( AuthorCheckListView* qlv, const Element &author );
-	AuthorCheckListItem( AuthorCheckListView* qlv, Q3ListViewItem *after, const Element \
                &author );
-
-	Element author() const;
-
-	virtual QString text( int column ) const;
-
-protected:
-	virtual void stateChange( bool on );
-
-private:
-	Element authorStored;
-	AuthorCheckListView *m_listview;
-};
-
-
-class AuthorListView : public DBListViewBase
-{
-	Q_OBJECT
-
-public:
-	AuthorListView( QWidget *parent, RecipeDB *db );
-
-protected slots:
-	void checkCreateAuthor( const Element &el );
-	virtual void createAuthor( const Element & ) = 0;
-	virtual void removeAuthor( int ) = 0;
-	virtual void load( int curr_limit, int curr_offset );
-
-};
-
-class StdAuthorListView : public AuthorListView
-{
-	Q_OBJECT
-
-public:
-	StdAuthorListView( QWidget *parent, RecipeDB *db, bool editable = false );
-
-protected:
-	virtual void createAuthor( const Element & );
-	virtual void removeAuthor( int );
-};
-
-
-class AuthorCheckListView : public AuthorListView
-{
-public:
-	AuthorCheckListView( QWidget *parent, RecipeDB *db );
-
-	virtual void stateChange(AuthorCheckListItem *,bool);
-
-	QList<Element> selections() const{ return m_selections; }
-
-protected:
-	virtual void createAuthor( const Element &ing );
-	virtual void removeAuthor( int );
-
-	virtual void load( int limit, int offset );
-
-private:
-	QList<Element> m_selections;
-};
-
-#endif //AUTHORLISTVIEW_H
diff --git a/src/widgets/conversiontable.cpp b/src/widgets/conversiontable.cpp
deleted file mode 100644
index 34ae481..0000000
--- a/src/widgets/conversiontable.cpp
+++ /dev/null
@@ -1,423 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2003-2004 Unai Garro <ugarro@gmail.com>                   *
-*   Copyright  © 2003-2006 Jason Kivlighn <jkivlighn@gmail.com>            *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#include "conversiontable.h"
-#include "datablocks/mixednumber.h"
-#include "widgets/fractioninput.h"
-
-#include <QToolTip>
-
-#include <kglobal.h>
-#include <klocale.h>
-
-class ConversionTableToolTip 
-{
-public:
-	ConversionTableToolTip( ConversionTable *t ) : table( t )
-	{}
-
-	void maybeTip( const QPoint &pos )
-	{
-		if ( !table )
-			return ;
-
-		QPoint cp = table->viewportToContents( pos );
-
-		int row = table->rowAt( cp.y() );
-		int col = table->columnAt( cp.x() );
-
-		if ( row == col )
-			return ;
-
-		QString row_unit = table->verticalHeader() ->label( row );
-		QString col_unit = table->horizontalHeader() ->label( col );
-		QString text = table->text( row, col );
-		if ( text.isEmpty() )
-			text = 'X'; //### Is this i18n friendly???
-
-		QRect cr = table->cellGeometry( row, col );
-		cr.moveTopLeft( table->contentsToViewport( cr.topLeft() ) );
-		QToolTip::showText( pos, QString( "1 %1 = %2 %3" ).arg( row_unit ).arg( text \
                ).arg( col_unit ), table->viewport(), cr );		
-	}
-
-private:
-	ConversionTable *table;
-};
-
-ConversionTable::ConversionTable( QWidget* parent, int maxrows, int maxcols ) : \
                Q3Table( maxrows, maxcols, parent, "table" )
-{
-	editBoxValue = -1;
-	items.setAutoDelete( true );
-	widgets.setAutoDelete( true );
-
-	( void ) new ConversionTableToolTip( this );
-}
-
-ConversionTable::~ConversionTable()
-{}
-#include <kdebug.h>
-void ConversionTable::unitRemoved( int id )
-{
-	int index = unitIDs.indexOf( id );
-	kDebug() << "index:" << index ;
-	removeRow( index );
-	removeColumn( index );
-	kDebug() << "done" ;
-}
-
-void ConversionTable::unitCreated( const Unit &unit )
-{
-	insertColumns( numCols() );
-	insertRows( numRows() );
-	unitIDs.append( unit.id() );
-	horizontalHeader() ->setLabel( numRows() - 1, unit.name() );
-	verticalHeader() ->setLabel( numCols() - 1, unit.name() );
-}
-
-Q3TableItem* ConversionTable::item( int r, int c ) const
-{
-	return items.find( indexOf( r, c ) );
-}
-
-void ConversionTable::setItem( int r, int c, Q3TableItem *i )
-{
-	items.replace( indexOf( r, c ), i );
-	i->setRow( r ); // Otherwise the item
-	i->setCol( c ); //doesn't know where it is!
-	updateCell( r, c );
-}
-
-void ConversionTable::clearCell( int r, int c )
-{
-	items.remove( indexOf( r, c ) );
-}
-
-void ConversionTable::takeItem( Q3TableItem *item )
-{
-	items.setAutoDelete( false );
-	items.remove( indexOf( item->row(), item->col() ) );
-	items.setAutoDelete( true );
-}
-
-void ConversionTable::insertWidget( int r, int c, QWidget *w )
-{
-	widgets.replace( indexOf( r, c ), w );
-}
-
-QWidget* ConversionTable::cellWidget( int r, int c ) const
-{
-	return widgets.find( indexOf( r, c ) );
-}
-
-void ConversionTable::clearCellWidget( int r, int c )
-{
-	QWidget * w = widgets.take( indexOf( r, c ) );
-	if ( w )
-		w->deleteLater();
-}
-
-
-ConversionTableItem::ConversionTableItem( Q3Table *t, EditType et ) : Q3TableItem( \
                t, et, QString() )
-{
-	//  we  do  not  want  this  item  to  be  replaced
-	setReplaceable( false );
-}
-
-void ConversionTableItem::paint( QPainter *p, const QColorGroup &cg, const QRect \
                &cr, bool selected )
-{
-	QColorGroup g( cg );
-
-	// Draw in gray all those cells which are not editable
-
-	if ( row() == col() )
-		g.setColor( QColorGroup::Base, Qt::gray );
-	Q3TableItem::paint( p, g, cr, selected );
-}
-
-QWidget* ConversionTableItem::createEditor() const
-{
-	FractionInput *editor = new FractionInput( table()->viewport(), \
                MixedNumber::DecimalFormat );
-
-	MixedNumber current;
-	MixedNumber::fromString( text(), current );
-	if ( current.toDouble() > 1e-8 )
-		editor->setValue( current, 0 );
-
-	return editor;
-}
-
-void ConversionTableItem::setContentFromEditor( QWidget *w )
-{
-	// the  user changed the value of the combobox, so synchronize the
-	// value of the item (its text), with the value of the combobox
-	if ( w->inherits( "FractionInput" ) ) {
-		FractionInput* editor = ( FractionInput* ) w;
-		if ( editor->isInputValid() && !editor->isEmpty() && editor->value().toDouble() > \
                1e-6 ) {
-			setText( editor->value().toString(MixedNumber::DecimalFormat) );
-			emit ratioChanged( row(), col(), editor->value().toDouble() ); // Signal to store
-		}
-		else {
-			setText( QString() );
-			emit ratioRemoved( row(), col() );
-		}
-	}
-	else
-		Q3TableItem::setContentFromEditor( w );
-}
-
-void ConversionTableItem::setText( const QString &s )
-{
-	Q3TableItem::setText( s );
-}
-QString ConversionTable::text( int r, int c ) const			 // without this function, the \
                usual (text(r,c)) won't work
-{
-	if ( item( r, c ) )
-		return item( r, c ) ->text();  //Note that item(r,c) was reimplemented here for \
                large sparse tables...
-	else
-		return QString();
-}
-
-void ConversionTable::initTable()
-{
-
-	for ( int r = 0;r < numRows();r++ ) {
-		this->createNewItem( r, r, 1.0 );
-		item( r, r ) ->setEnabled( false ); // Diagonal is not editable
-	}
-}
-
-void ConversionTable::createNewItem( int r, int c, double amount )
-{
-
-	ConversionTableItem * ci = new ConversionTableItem( this, Q3TableItem::WhenCurrent \
                );
-	ci->setText( beautify( KGlobal::locale() ->formatNumber( amount, 5 ) ) );
-	setItem( r, c, ci );
-	// connect signal (forward) to know when it's actually changed
-	connect( ci, SIGNAL( ratioChanged( int, int, double ) ), this, SIGNAL( \
                ratioChanged( int, int, double ) ) );
-	connect( ci, SIGNAL( ratioRemoved( int, int ) ), this, SIGNAL( ratioRemoved( int, \
                int ) ) );
-	connect( ci, SIGNAL( signalRepaintCell( int, int ) ), this, SLOT( repaintCell( int, \
                int ) ) );
-}
-
-void ConversionTable::setUnitIDs( const IDList &idList )
-{
-	unitIDs = idList;
-}
-
-void ConversionTable::setRatio( int ingID1, int ingID2, double ratio )
-{
-	int indexID1 = unitIDs.indexOf( ingID1 );
-	int indexID2 = unitIDs.indexOf( ingID2 );
-
-	createNewItem( indexID1, indexID2, ratio );
-}
-
-
-int ConversionTable::getUnitID( int rc )
-{
-	return unitIDs.at( rc );
-}
-
-QWidget * ConversionTable::beginEdit ( int row, int col, bool replace )
-{
-	// If there's no item, create it first.
-	if ( !item( row, col ) ) {
-		createNewItem( row, col, 0 );
-	}
-
-	// Then call normal beginEdit
-	return Q3Table::beginEdit( row, col, replace );
-}
-
-void ConversionTableItem::setTextAndSave( const QString &s )
-{
-	setText( s ); // Change text
-	emit signalRepaintCell( row(), col() ); // Indicate to update the cell to the \
                table. Otherwise it's not repainted
-	emit ratioChanged( row(), col(), s.toDouble() ); // Signal to store
-}
-
-void ConversionTable::repaintCell( int r, int c )
-{
-	Q3Table::updateCell( r, c );
-}
-
-void ConversionTable::resize( int r, int c )
-{
-	setNumRows( r );
-	setNumCols( c );
-	initTable();
-}
-
-void ConversionTable::clear( void )
-{
-	items.clear();
-	widgets.clear();
-	unitIDs.clear();
-	resize( 0, 0 );
-
-}
-
-//TODO this is incomplete/wrong
-void ConversionTable::swapRows( int row1, int row2, bool /*swapHeader*/ )
-{
-	//if ( swapHeader )
-	//((QTableHeader*)verticalHeader())->swapSections( row1, row2, false );
-
-	QVector<Q3TableItem*> tmpContents;
-	tmpContents.resize( numCols() );
-	QVector<QWidget*> tmpWidgets;
-	tmpWidgets.resize( numCols() );
-	int i;
-
-	items.setAutoDelete( false );
-	widgets.setAutoDelete( false );
-	for ( i = 0; i < numCols(); ++i ) {
-		Q3TableItem *i1, *i2;
-		i1 = item( row1, i );
-		i2 = item( row2, i );
-		if ( i1 || i2 ) {
-			tmpContents.insert( i, i1 );
-			items.remove( indexOf( row1, i ) );
-			items.insert( indexOf( row1, i ), i2 );
-			items.remove( indexOf( row2, i ) );
-			items.insert( indexOf( row2, i ), tmpContents[ i ] );
-			if ( items[ indexOf( row1, i ) ] )
-				items[ indexOf( row1, i ) ] ->setRow( row1 );
-			if ( items[ indexOf( row2, i ) ] )
-				items[ indexOf( row2, i ) ] ->setRow( row2 );
-		}
-
-		QWidget *w1, *w2;
-		w1 = cellWidget( row1, i );
-		w2 = cellWidget( row2, i );
-		if ( w1 || w2 ) {
-			tmpWidgets.insert( i, w1 );
-			widgets.remove( indexOf( row1, i ) );
-			widgets.insert( indexOf( row1, i ), w2 );
-			widgets.remove( indexOf( row2, i ) );
-			widgets.insert( indexOf( row2, i ), tmpWidgets[ i ] );
-		}
-	}
-	items.setAutoDelete( false );
-	widgets.setAutoDelete( true );
-
-	//updateRowWidgets( row1 );
-	//updateRowWidgets( row2 );
-	/*
-	if ( curRow == row1 )
-	curRow = row2;
-	else if ( curRow == row2 )
-	curRow = row1;
-	if ( editRow == row1 )
-	editRow = row2;
-	else if ( editRow == row2 )
-	editRow = row1;*/
-}
-
-//TODO this is incomplete/wrong
-void ConversionTable::swapColumns( int col1, int col2, bool /*swapHeader*/ )
-{
-	//if ( swapHeader )
-	//((QTableHeader*)horizontalHeader())->swapSections( col1, col2, false );
-
-	QVector<Q3TableItem*> tmpContents;
-	tmpContents.resize( numRows() );
-	QVector<QWidget*> tmpWidgets;
-	tmpWidgets.resize( numRows() );
-	int i;
-
-	items.setAutoDelete( false );
-	widgets.setAutoDelete( false );
-	for ( i = 0; i < numRows(); ++i ) {
-		Q3TableItem *i1, *i2;
-		i1 = item( i, col1 );
-		i2 = item( i, col2 );
-		if ( i1 || i2 ) {
-			tmpContents.insert( i, i1 );
-			items.remove( indexOf( i, col1 ) );
-			items.insert( indexOf( i, col1 ), i2 );
-			items.remove( indexOf( i, col2 ) );
-			items.insert( indexOf( i, col2 ), tmpContents[ i ] );
-			if ( items[ indexOf( i, col1 ) ] )
-				items[ indexOf( i, col1 ) ] ->setCol( col1 );
-			if ( items[ indexOf( i, col2 ) ] )
-				items[ indexOf( i, col2 ) ] ->setCol( col2 );
-		}
-
-		QWidget *w1, *w2;
-		w1 = cellWidget( i, col1 );
-		w2 = cellWidget( i, col2 );
-		if ( w1 || w2 ) {
-			tmpWidgets.insert( i, w1 );
-			widgets.remove( indexOf( i, col1 ) );
-			widgets.insert( indexOf( i, col1 ), w2 );
-			widgets.remove( indexOf( i, col2 ) );
-			widgets.insert( indexOf( i, col2 ), tmpWidgets[ i ] );
-		}
-	}
-	items.setAutoDelete( false );
-	widgets.setAutoDelete( true );
-
-	columnWidthChanged( col1 );
-	columnWidthChanged( col2 );
-	/*
-	if ( curCol == col1 )
-	curCol = col2;
-	else if ( curCol == col2 )
-	curCol = col1;
-	if ( editCol == col1 )
-	editCol = col2;
-	else if ( editCol == col2 )
-	editCol = col1;*/
-}
-
-//TODO this is incomplete/wrong
-void ConversionTable::swapCells( int row1, int col1, int row2, int col2 )
-{
-	items.setAutoDelete( false );
-	widgets.setAutoDelete( false );
-	Q3TableItem *i1, *i2;
-	i1 = item( row1, col1 );
-	i2 = item( row2, col2 );
-	if ( i1 || i2 ) {
-		Q3TableItem * tmp = i1;
-		items.remove( indexOf( row1, col1 ) );
-		items.insert( indexOf( row1, col1 ), i2 );
-		items.remove( indexOf( row2, col2 ) );
-		items.insert( indexOf( row2, col2 ), tmp );
-		if ( items[ indexOf( row1, col1 ) ] ) {
-			items[ indexOf( row1, col1 ) ] ->setRow( row1 );
-			items[ indexOf( row1, col1 ) ] ->setCol( col1 );
-		}
-		if ( items[ indexOf( row2, col2 ) ] ) {
-			items[ indexOf( row2, col2 ) ] ->setRow( row2 );
-			items[ indexOf( row2, col2 ) ] ->setCol( col2 );
-		}
-	}
-
-	QWidget *w1, *w2;
-	w1 = cellWidget( row1, col1 );
-	w2 = cellWidget( row2, col2 );
-	if ( w1 || w2 ) {
-		QWidget * tmp = w1;
-		widgets.remove( indexOf( row1, col1 ) );
-		widgets.insert( indexOf( row1, col1 ), w2 );
-		widgets.remove( indexOf( row2, col2 ) );
-		widgets.insert( indexOf( row2, col2 ), tmp );
-	}
-
-	//updateRowWidgets( row1 );
-	//updateRowWidgets( row2 );
-	//updateColWidgets( col1 );
-	//updateColWidgets( col2 );
-	items.setAutoDelete( false );
-	widgets.setAutoDelete( true );
-}
-
-#include "conversiontable.moc"
diff --git a/src/widgets/conversiontable.h b/src/widgets/conversiontable.h
deleted file mode 100644
index 456f0f3..0000000
--- a/src/widgets/conversiontable.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2003-2004 Unai Garro <ugarro@gmail.com>                   *
-*   Copyright  © 2003-2004 Jason Kivlighn <jkivlighn@gmail.com>            *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-#ifndef CONVERSIONTABLE_H
-#define CONVERSIONTABLE_H
-#include <QString>
-#include <q3table.h>
-#include <QObject>
-
-#include "datablocks/unitratio.h"
-#include "datablocks/elementlist.h"
-#include "datablocks/unit.h"
-
-/**
-@author Unai Garro
-*/
-
-
-class ConversionTable: public Q3Table
-{
-	Q_OBJECT
-public:
-
-	ConversionTable( QWidget* parent, int maxrows, int maxcols );
-	~ConversionTable();
-	void createNewItem( int r, int c, double amount );
-	void setUnitIDs( const IDList &idList );
-	void setRatio( int ingID1, int ingID2, double ratio );
-	void setRatio( const UnitRatio &r )
-	{
-		setRatio( r.unitId1(), r.unitId2(), r.ratio() );
-	}
-	int getUnitID( int rc );
-	QString text( int r, int c ) const; //Reimplement, otherwise it won't work this way
-	void resize( int r, int c );
-	void clear( void );
-private:
-
-	//Internal Variables
-	double editBoxValue;
-	Q3IntDict<Q3TableItem> items;
-	Q3IntDict<QWidget> widgets;
-	IDList unitIDs; // unit ID list to know the units by ID, not name
-	//Internal Methods
-	void resizeData( int )
-	{}
-	;
-	Q3TableItem *item( int r, int c ) const;
-	void setItem( int r, int c, Q3TableItem *i );
-	void clearCell( int r, int c );
-	void takeItem( Q3TableItem *item );
-	void insertWidget( int r, int c, QWidget *w );
-	QWidget *cellWidget( int r, int c ) const;
-	void clearCellWidget( int r, int c );
-	void initTable();
-	void swapRows( int, int, bool );
-	void swapColumns( int, int, bool );
-	void swapCells( int, int, int, int );
-protected:
-	QWidget* beginEdit ( int row, int col, bool replace );
-
-private slots:
-	void repaintCell( int r, int c );
-
-	void unitRemoved( int );
-	void unitCreated( const Unit& );
-signals:
-	void ratioChanged( int row, int col, double value );
-	void ratioRemoved( int row, int col );
-};
-
-class ConversionTableItem: public QObject, public Q3TableItem
-{
-	Q_OBJECT
-public:
-	ConversionTableItem( Q3Table *t, EditType et );
-	QWidget *createEditor() const;
-	void setContentFromEditor( QWidget *w );
-	void setText( const QString &s );
-	void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
-	void setTextAndSave( const QString &s );
-	int alignment() const
-	{
-		return Qt::AlignRight;
-	}
-signals:
-	void ratioChanged( int row, int col, double value );
-	void ratioRemoved( int row, int col );
-	void signalRepaintCell( int r, int c );
-
-};
-
-
-#endif
diff --git a/src/widgets/headerlistview.cpp b/src/widgets/headerlistview.cpp
deleted file mode 100644
index 5f2dbd2..0000000
--- a/src/widgets/headerlistview.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*   Copyright  © 2004 Unai Garro <ugarro@gmail.com>                        *
-*   Copyright  © 2004 Cyril Bosselut <bosselut@b1project.com>              *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#include "headerlistview.h"
-
-#include <kmessagebox.h>
-#include <kconfig.h>
-#include <klocale.h>
-#include <kglobal.h>
-#include <kmenu.h>
-#include <QPointer>
-
-#include "backends/recipedb.h"
-#include "dialogs/createelementdialog.h"
-#include "dialogs/dependanciesdialog.h"
-
-HeaderListView::HeaderListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( \
                parent,db,db->unitCount() )
-{
-	setAllColumnsShowFocus( true );
-	setDefaultRenameAction( Q3ListView::Reject );
-	connect( database, SIGNAL( ingGroupCreated( const Element & ) ), SLOT( \
                checkCreateHeader( const Element & ) ) );
-	connect( database, SIGNAL( ingGroupRemoved( int ) ), SLOT( removeHeader( int ) ) );
-}
-
-void HeaderListView::load( int /*limit*/, int /*offset*/ )
-{
-	ElementList headerList;
-	database->loadIngredientGroups( &headerList );
-
-	setTotalItems(headerList.count());
-
-	for ( ElementList::const_iterator it = headerList.constBegin(); it != \
                headerList.constEnd(); ++it ) {
-		createHeader( *it );
-	}
-}
-
-void HeaderListView::checkCreateHeader( const Element &el )
-{
-	if ( handleElement(el.name) ) { //only create this header if the base class okays \
                it
-		createHeader(el);
-	}
-}
-
-
-StdHeaderListView::StdHeaderListView( QWidget *parent, RecipeDB *db, bool editable ) \
                : HeaderListView( parent, db )
-{
-	addColumn( i18nc( "@title:column", "Header" ) );
-
-	KConfigGroup config = KGlobal::config()->group( "Advanced" );
-	bool show_id = config.readEntry( "ShowID", false );
-
-	addColumn( i18nc( "@title:column", "Id" ) , show_id ? -1 : 0 );
-
-	if ( editable ) {
-		setRenameable( 0, true );
-	}
-}
-
-void StdHeaderListView::createHeader( const Element &header )
-{
-	createElement(new Q3ListViewItem( this, header.name, QString::number( header.id ) \
                ));
-}
-
-void StdHeaderListView::removeHeader( int id )
-{
-	Q3ListViewItem * item = findItem( QString::number( id ), 1 );
-	removeElement(item);
-}
-
-#include "headerlistview.moc"
diff --git a/src/widgets/headerlistview.h b/src/widgets/headerlistview.h
deleted file mode 100644
index b2a7bbb..0000000
--- a/src/widgets/headerlistview.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*   Copyright  © 2004 Unai Garro <ugarro@gmail.com>                        *
-*   Copyright  © 2004 Cyril Bosselut <bosselut@b1project.com>              *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#ifndef HEADERLISTVIEW_H
-#define HEADERLISTVIEW_H
-
-#include "dblistviewbase.h"
-
-#include "datablocks/element.h"
-
-class RecipeDB;
-class KMenu;
-
-class HeaderListView : public DBListViewBase
-{
-	Q_OBJECT
-
-public:
-	HeaderListView( QWidget *parent, RecipeDB *db );
-
-public slots:
-	virtual void load( int curr_limit, int curr_offset );
-
-protected slots:
-	virtual void createHeader( const Element & ) = 0;
-	virtual void removeHeader( int ) = 0;
-
-	void checkCreateHeader( const Element &el );
-
-};
-
-class StdHeaderListView : public HeaderListView
-{
-	Q_OBJECT
-
-public:
-	StdHeaderListView( QWidget *parent, RecipeDB *db, bool editable = false );
-
-protected:
-	virtual void createHeader( const Element & );
-	virtual void removeHeader( int );
-};
-
-#endif //HEADERLISTVIEW_H
diff --git a/src/widgets/prepmethodlistview.cpp b/src/widgets/prepmethodlistview.cpp
deleted file mode 100644
index acd1aa6..0000000
--- a/src/widgets/prepmethodlistview.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#include "prepmethodlistview.h"
-
-#include <kmessagebox.h>
-#include <kconfig.h>
-#include <klocale.h>
-#include <kglobal.h>
-#include <kmenu.h>
-#include <QPointer>
-
-#include "backends/recipedb.h"
-#include "dialogs/createelementdialog.h"
-#include "dialogs/dependanciesdialog.h"
-
-PrepMethodListView::PrepMethodListView( QWidget *parent, RecipeDB *db ) : \
                DBListViewBase( parent,db,db->prepMethodCount())
-{
-	setAllColumnsShowFocus( true );
-	setDefaultRenameAction( Q3ListView::Reject );
-	connect( database, SIGNAL( prepMethodCreated( const Element & ) ), SLOT( \
                checkCreatePrepMethod( const Element & ) ) );
-	connect( database, SIGNAL( prepMethodRemoved( int ) ), SLOT( removePrepMethod( int \
                ) ) );
-}
-
-void PrepMethodListView::load( int limit, int offset )
-{
-	ElementList prepMethodList;
-	database->loadPrepMethods( &prepMethodList, limit, offset );
-
-	setTotalItems(prepMethodList.count());
-
-	for ( ElementList::const_iterator ing_it = prepMethodList.constBegin(); ing_it != \
                prepMethodList.constEnd(); ++ing_it )
-		createPrepMethod( *ing_it );
-}
-
-void PrepMethodListView::checkCreatePrepMethod( const Element &el )
-{
-	if ( handleElement(el.name) ) { //only create this prep method if the base class \
                okays it
-		createPrepMethod(el);
-	}
-}
-
-
-StdPrepMethodListView::StdPrepMethodListView( QWidget *parent, RecipeDB *db, bool \
                editable ) : PrepMethodListView( parent, db )
-{
-	addColumn( i18nc( "@title:column", "Preparation Method" ) );
-
-	KConfigGroup config = KGlobal::config()->group( "Advanced" );
-	bool show_id = config.readEntry( "ShowID", false );
-	addColumn( i18nc( "@title:column", "Id" ) , show_id ? -1 : 0 );
-
-	if ( editable ) {
-		setRenameable( 0, true );
-	}
-}
-
-void StdPrepMethodListView::createPrepMethod( const Element &ing )
-{
-	createElement(new Q3ListViewItem( this, ing.name, QString::number( ing.id ) ));
-}
-
-void StdPrepMethodListView::removePrepMethod( int id )
-{
-	Q3ListViewItem * item = findItem( QString::number( id ), 1 );
-	removeElement(item);
-}
-
-#include "prepmethodlistview.moc"
diff --git a/src/widgets/prepmethodlistview.h b/src/widgets/prepmethodlistview.h
deleted file mode 100644
index 98fef43..0000000
--- a/src/widgets/prepmethodlistview.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#ifndef PREPMETHODLISTVIEW_H
-#define PREPMETHODLISTVIEW_H
-
-#include "dblistviewbase.h"
-
-#include "datablocks/element.h"
-
-class RecipeDB;
-class KMenu;
-
-class PrepMethodListView : public DBListViewBase
-{
-	Q_OBJECT
-
-public:
-	PrepMethodListView( QWidget *parent, RecipeDB *db );
-
-public slots:
-	virtual void load( int curr_limit, int curr_offset );
-
-protected slots:
-	virtual void createPrepMethod( const Element & ) = 0;
-	virtual void removePrepMethod( int ) = 0;
-
-	void checkCreatePrepMethod( const Element &el );
-};
-
-
-class StdPrepMethodListView : public PrepMethodListView
-{
-	Q_OBJECT
-
-public:
-	StdPrepMethodListView( QWidget *parent, RecipeDB *db, bool editable = false );
-
-protected:
-	virtual void createPrepMethod( const Element & );
-	virtual void removePrepMethod( int );
-};
-
-#endif //PREPMETHODLISTVIEW_H
diff --git a/src/widgets/recipelistview.cpp b/src/widgets/recipelistview.cpp
deleted file mode 100644
index c91fdf8..0000000
--- a/src/widgets/recipelistview.cpp
+++ /dev/null
@@ -1,441 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Unai Garro <ugarro@gmail.com>                        *
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#include "recipelistview.h"
-
-#include <q3intdict.h>
-#include <qdatastream.h>
-#include <QToolTip>
-//Added by qt3to4:
-#include <QDropEvent>
-
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kconfig.h>
-#include <kglobal.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kprogressdialog.h>
-
-#include "backends/recipedb.h"
-
-class UncategorizedItem : public Q3ListViewItem
-{
-public:
-	UncategorizedItem( Q3ListView *lv ) : Q3ListViewItem( lv, i18n("Uncategorized") ){}
-	int rtti() const { return 1006; }
-};
-
-RecipeItemDrag::RecipeItemDrag( RecipeListItem *recipeItem, QWidget *dragSource, \
                const char *name )
-		: Q3StoredDrag( RECIPEITEMMIMETYPE, dragSource, name )
-{
-	if ( recipeItem ) {
-		QByteArray data;
-		QDataStream out( &data, QIODevice::WriteOnly );
-		out << recipeItem->recipeID();
-		out << recipeItem->title();
-		setEncodedData( data );
-	}
-}
-
-bool RecipeItemDrag::canDecode( QMimeSource* e )
-{
-	return e->provides( RECIPEITEMMIMETYPE );
-}
-
-bool RecipeItemDrag::decode( const QMimeSource* e, RecipeListItem& item )
-{
-	if ( !e )
-		return false;
-
-	QByteArray data = e->encodedData( RECIPEITEMMIMETYPE );
-	if ( data.isEmpty() )
-		return false;
-
-	QString title;
-	int recipeID;
-	QDataStream in( &data, QIODevice::ReadOnly );
-	in >> recipeID;
-	in >> title;
-
-	item.setTitle( title );
-	item.setRecipeID( recipeID );
-
-	return true;
-}
-
-class RecipeListToolTip 
-{
-public:
-	RecipeListToolTip( RecipeListView *view ) : m_view(view)
-	{}
-
-	void maybeTip( const QPoint &point )
-	{
-		Q3ListViewItem *item = m_view->itemAt( point );
-		if ( item ) {
-			QString text = m_view->tooltip(item,0);
-			if ( !text.isEmpty() )
-				QToolTip::showText( point, text, m_view->viewport(), m_view->itemRect( item ) );
-		}
-	}
-
-private:
-	RecipeListView *m_view;
-
-};
-
-
-RecipeListView::RecipeListView( QWidget *parent, RecipeDB *db ) : \
                StdCategoryListView( parent, db ),
-		flat_list( false ),
-		m_uncat_item(0),
-		m_progress_dlg(0)
-{
-	setColumnText( 0, i18n( "Recipe" ) );
-
-	KConfigGroup config = KGlobal::config()->group( "Performance" );
-	curr_limit = config.readEntry("CategoryLimit",-1);
-
-	KIconLoader *il = KIconLoader::global();
-	setPixmap( il->loadIcon( "folder-yellow", KIconLoader::NoGroup, 16 ) );
-
-	setSelectionMode( Q3ListView::Extended );
-
-	(void)new RecipeListToolTip(this);
-
-	connect( database, SIGNAL( recipeCreated( const Element &, const ElementList & ) ), \
                SLOT( createRecipe( const Element &, const ElementList & ) ) );
-	connect( database, SIGNAL( recipeRemoved( int ) ), SLOT( removeRecipe( int ) ) );
-	connect( database, SIGNAL( recipeRemoved( int, int ) ), SLOT( removeRecipe( int, \
                int ) ) );
-	connect( database, SIGNAL( recipeModified( const Element &, const ElementList & ) \
                ), SLOT( modifyRecipe( const Element &, const ElementList & ) ) );
-
-}
-
-Q3DragObject *RecipeListView::dragObject()
-{
-	RecipeListItem * item = dynamic_cast<RecipeListItem*>( currentItem() );
-	if ( item != 0 ) {
-		RecipeItemDrag * obj = new RecipeItemDrag( item, this, "Recipe drag item" );
-		/*const QPixmap *pm = item->pixmap(0);
-		if( pm )
-			obj->setPixmap( *pm );*/ 
-		return obj;
-	}
-	return 0;
-}
-
-bool RecipeListView::acceptDrag( QDropEvent *event ) const
-{
-	return RecipeItemDrag::canDecode( event );
-}
-
-QString RecipeListView::tooltip(Q3ListViewItem *item, int /*column*/) const
-{
-	if ( item->rtti() == RECIPELISTITEM_RTTI ) {
-		RecipeListItem *recipe_it = (RecipeListItem*)item;
-
-		Recipe r;
-		database->loadRecipe(&r,RecipeDB::Meta|RecipeDB::Noatime,recipe_it->recipeID() );
-
-		KLocale *locale = KGlobal::locale();
-
-		return QString("<center><b>%7</b></center><center>__________</center>%1 %2<br />%3 \
                %4<br />%5 %6")
-		.arg(i18nc("Recipe created", "Created:")).arg(locale->formatDateTime(r.ctime))
-		.arg(i18nc("Recipe modified", "Modified:")).arg(locale->formatDateTime(r.mtime))
-		.arg(i18nc("Recipe last accessed", "Last \
                Accessed:")).arg(locale->formatDateTime(r.atime))
-		.arg(recipe_it->title());
-	}/* Maybe this would be handy
-	else if ( item->rtti() == CATEGORYLISTITEM_RTTI ) {
-		CategoryListItem *cat_it = (CategoryListItem*)item;
-
-		return QString("<b>%1</b><hr />%2: %3")
-		.arg(cat_it->categoryName())
-		.arg(i18n("Recipes"))
-		.arg(QString::number(WHATEVER THE CHILD COUNT IS));
-	}*/
-
-	return QString();
-}
-
-void RecipeListView::load(int limit, int offset)
-{
-	m_uncat_item = 0;
-
-	if ( flat_list ) {
-		ElementList recipeList;
-		database->loadRecipeList( &recipeList );
-
-		ElementList::const_iterator recipe_it;
-		for ( recipe_it = recipeList.constBegin();recipe_it != \
                recipeList.constEnd();++recipe_it ) {
-			Recipe recipe;
-			recipe.recipeID = ( *recipe_it ).id;
-			recipe.title = ( *recipe_it ).name;
-			createRecipe( recipe, -1 );
-		}
-	}
-	else {
-		StdCategoryListView::load(limit,offset);
-
-		if ( offset == 0 ) {
-			ElementList recipeList;
-			database->loadUncategorizedRecipes( &recipeList );
-
-			ElementList::const_iterator recipe_it;
-			for ( recipe_it = recipeList.constBegin();recipe_it != \
                recipeList.constEnd();++recipe_it ) {
-				Recipe recipe;
-				recipe.recipeID = ( *recipe_it ).id;
-				recipe.title = ( *recipe_it ).name;
-				createRecipe( recipe, -1 );
-			}
-		}
-	}
-}
-
-void RecipeListView::populate( Q3ListViewItem *item )
-{
-	CategoryItemInfo *cat_item = dynamic_cast<CategoryItemInfo*>(item);
-	if ( !cat_item || cat_item->isPopulated() ) return;
-
-	delete item->firstChild(); //delete the "pseudo item"
-
-	if ( m_progress_dlg ){
-		m_progress_dlg->progressBar()->setValue(m_progress_dlg->progressBar()->value() + \
                1);
-		kapp->processEvents();
-	}
-
-	StdCategoryListView::populate(item);
-
-	if ( !flat_list ) {
-		int id = cat_item->categoryId();
-
-		// Now show the recipes
-		ElementList recipeList;
-		database->loadRecipeList( &recipeList, id );
-
-		ElementList::const_iterator recipe_it;
-		for ( recipe_it = recipeList.constBegin(); recipe_it != recipeList.constEnd(); \
                ++recipe_it ) {
-			Recipe recipe;
-			recipe.recipeID = ( *recipe_it ).id;
-			recipe.title = ( *recipe_it ).name;
-			createRecipe( recipe, id );
-		}
-	}
-}
-
-void RecipeListView::populateAll( Q3ListViewItem *parent )
-{
-	bool first = false;
-	if ( !parent ) {
-		first = true;
-		m_progress_dlg = new KProgressDialog(this,QString(),i18nc("@info:progress", \
                "Loading recipes"));
-		m_progress_dlg->setObjectName( "populate_all_prog_dlg" );
-		m_progress_dlg->setModal( true );
-		m_progress_dlg->setAllowCancel(false);
-		m_progress_dlg->progressBar()->setRange(0,0);
-
-		m_progress_dlg->grabKeyboard(); //don't let the user keep hitting keys
-
-		parent = firstChild();
-	}
-	else {
-		populate( parent );
-		parent = parent->firstChild();
-	}
-
-	for ( Q3ListViewItem *item = parent; item; item = item->nextSibling() ) {
-		if ( m_progress_dlg && m_progress_dlg->wasCancelled() )
-			break;
-
-		populateAll( item );
-	}
-
-	if ( first ) {
-		delete m_progress_dlg;
-		m_progress_dlg = 0;
-	}
-}
-
-void RecipeListView::createRecipe( const Recipe &recipe, int parent_id )
-{
-	if ( parent_id == -1 ) {
-		if ( !m_uncat_item && curr_offset == 0 ) {
-			m_uncat_item = new UncategorizedItem(this);
-		}
-
-		if ( m_uncat_item )
-			createElement(new RecipeListItem( m_uncat_item, recipe ));
-	}
-	else {
-		CategoryListItem *parent = (CategoryListItem*)items_map[ parent_id ];
-		if ( parent && parent->isPopulated() )
-			createElement(new RecipeListItem( parent, recipe ));
-	}
-}
-
-void RecipeListView::createRecipe( const Element &recipe_el, const ElementList \
                &categories )
-{
-	Recipe recipe;
-	recipe.recipeID = recipe_el.id;
-	recipe.title = recipe_el.name;
-
-	if ( categories.isEmpty() ) {
-		createRecipe( recipe, -1 );
-	}
-	else {
-		for ( ElementList::const_iterator cat_it = categories.begin(); cat_it != \
                categories.end(); ++cat_it ) {
-			int cur_cat_id = ( *cat_it ).id;
-
-			Q3ListViewItemIterator iterator( this );
-			while ( iterator.current() ) {
-				if ( iterator.current() ->rtti() == 1001 ) {
-					CategoryListItem * cat_item = ( CategoryListItem* ) iterator.current();
-					if ( cat_item->categoryId() == cur_cat_id ) {
-						createRecipe( recipe, cur_cat_id );
-					}
-				}
-				++iterator;
-			}
-		}
-	}
-}
-
-void RecipeListView::createElement( Q3ListViewItem *item )
-{
-	CategoryItemInfo *cat_item = dynamic_cast<CategoryItemInfo*>(item);
-	if ( cat_item && !cat_item->isPopulated() ) {
-		new PseudoListItem( item );
-	}
-
-	//if ( cat_item && !cat_item->isPopulated() && item->rtti() == RECIPELISTITEM_RTTI \
                )
-	//	return;
-
-	#if 0
-	ElementList list;
-	database->loadRecipeList( &list, cat_item->categoryId() );
-	if ( list.count() > 0 )
-	#endif
-
-	CategoryListView::createElement(item);
-}
-
-void RecipeListView::modifyRecipe( const Element &recipe, const ElementList \
                &categories )
-{
-	removeRecipe( recipe.id );
-	createRecipe( recipe, categories );
-}
-
-void RecipeListView::removeRecipe( int id )
-{
-	Q3ListViewItemIterator iterator( this );
-	while ( iterator.current() ) {
-		if ( iterator.current() ->rtti() == 1000 ) {
-			RecipeListItem * recipe_it = ( RecipeListItem* ) iterator.current();
-			if ( recipe_it->recipeID() == id ) {
-				removeElement(recipe_it);
-
-				//delete the "Uncategorized" item if we removed the last recipe that was under \
                it
-				if ( m_uncat_item && m_uncat_item->childCount() == 0 ) {
-					delete m_uncat_item;
-					m_uncat_item = 0;
-				}
-			}
-		}
-		++iterator;
-	}
-}
-
-void RecipeListView::removeRecipe( int recipe_id, int cat_id )
-{
-	Q3ListViewItem * item = items_map[ cat_id ];
-
-	if (!item)
-		return;
-
-	//find out if this is the only category the recipe belongs to
-	bool one_category;
-	Recipe r;
-	database->loadRecipe(&r, RecipeDB::Categories, recipe_id );
-	one_category = r.categoryList.isEmpty();
-
-	//do this to only iterate over children of 'item'
-	Q3ListViewItem *pEndItem = NULL;
-	Q3ListViewItem *pStartItem = item;
-	do {
-		if ( pStartItem->nextSibling() )
-			pEndItem = pStartItem->nextSibling();
-		else
-			pStartItem = pStartItem->parent();
-	}
-	while ( pStartItem && !pEndItem );
-
-	Q3ListViewItemIterator iterator( item );
-	while ( iterator.current() != pEndItem ) {
-		if ( iterator.current() ->rtti() == 1000 ) {
-			RecipeListItem * recipe_it = ( RecipeListItem* ) iterator.current();
-
-			if ( recipe_it->recipeID() == recipe_id ) {
-				
-				if ( one_category ) {
-					//the item is now uncategorized
-					kDebug() << "uncat";
-					if ( !m_uncat_item && curr_offset == 0 )
-						m_uncat_item = new UncategorizedItem(this);
-					if ( m_uncat_item ) {
-						Recipe r;
-						r.title = recipe_it->title(); r.recipeID = recipe_id;
-						new RecipeListItem(m_uncat_item,r);
-					}
-				}
-				removeElement(recipe_it);
-				break;
-			}
-		}
-		++iterator;
-	}
-}
-
-void RecipeListView::removeCategory( int id )
-{
-	Q3ListViewItem * item = items_map[ id ];
-	if ( !item )
-		return ; //this may have been deleted already by its parent being deleted
-
-	moveChildrenToRoot( item );
-
-	StdCategoryListView::removeCategory( id );
-}
-
-void RecipeListView::moveChildrenToRoot( Q3ListViewItem *item )
-{
-	Q3ListViewItem * next_sibling;
-	Recipe recipe;
-	for ( Q3ListViewItem * it = item->firstChild(); it; it = next_sibling ) {
-		next_sibling = it->nextSibling();
-		if ( it->rtti() == 1000 ) {
-			RecipeListItem *recipe_it = (RecipeListItem*) it;
-			removeElement(it,false);
-
-			//the item is now uncategorized if it's not part of other categories
-			database->loadRecipe( &recipe,
-				RecipeDB::Title|RecipeDB::Categories, recipe_it->recipeID() );
-
-			if ( recipe.categoryList.isEmpty() ) {
-				it->parent() ->takeItem( it );
-				if ( !m_uncat_item && curr_offset == 0 )
-					m_uncat_item = new UncategorizedItem(this);
-				if ( m_uncat_item )
-					new RecipeListItem(m_uncat_item,recipe);
-			}
-		}
-		moveChildrenToRoot( it );
-		delete it;
-	}
-}
-
-#include "recipelistview.moc"
diff --git a/src/widgets/unitlistview.cpp b/src/widgets/unitlistview.cpp
deleted file mode 100644
index 21fe169..0000000
--- a/src/widgets/unitlistview.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2003 Unai Garro <ugarro@gmail.com>                        *
-*   Copyright  © 2003 Cyril Bosselut <bosselut@b1project.com>              *
-*   Copyright  © 2003, 2006 Jason Kivlighn <jkivlighn@gmail.com>           *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#include "unitlistview.h"
-
-#include <KComboBox>
-#include <q3header.h>
-//Added by qt3to4:
-#include <QList>
-
-#include <kmessagebox.h>
-#include <kconfig.h>
-#include <klocale.h>
-#include <kglobal.h>
-#include <kmenu.h>
-#include <kdebug.h>
-#include <QPointer>
-
-#include "backends/recipedb.h"
-#include "dialogs/createunitdialog.h"
-#include "dialogs/dependanciesdialog.h"
-#include "datablocks/unit.h"
-
-
-UnitListView::UnitListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( \
                parent,db,db->unitCount() )
-{
-	setAllColumnsShowFocus( true );
-	setDefaultRenameAction( Q3ListView::Reject );
-	connect( database, SIGNAL( unitCreated( const Unit & ) ), SLOT( checkCreateUnit( \
                const Unit & ) ) );
-	connect( database, SIGNAL( unitRemoved( int ) ), SLOT( removeUnit( int ) ) );
-}
-
-void UnitListView::load( int limit, int offset )
-{
-	UnitList unitList;
-	database->loadUnits( &unitList, Unit::All, limit, offset );
-
-	for ( UnitList::const_iterator it = unitList.constBegin(); it != \
                unitList.constEnd(); ++it ) {
-		if ( !( *it ).name().isEmpty() || !( *it ).plural().isEmpty() )
-			createUnit( *it );
-	}
-}
-
-void UnitListView::checkCreateUnit( const Unit &el )
-{
-	if ( handleElement(el.name()) ) { //only create this unit if the base class okays \
                it
-		createUnit(el);
-	}
-}
-
-
-StdUnitListView::StdUnitListView( QWidget *parent, RecipeDB *db, bool editable ) : \
                UnitListView( parent, db )
-{
-	addColumn( i18nc( "@title:column Unit name", "Unit" ) );
-	addColumn( i18nc( "@title:column Unit abbreviation", "Abbreviation" ) );
-	addColumn( i18nc( "@title:column Unit plural", "Plural" ) );
-	addColumn( i18nc( "@title:column unit plural abbreviation", "Abbreviation" ) );
-	addColumn( i18nc( "@title:column Unit type", "Type" ) );
-
-	KConfigGroup config = KGlobal::config()->group( "Advanced" );
-	bool show_id = config.readEntry( "ShowID", false );
-	addColumn( i18nc( "@title:column", "Id" ), show_id ? -1 : 0 );
-
-	if ( editable ) {
-		setRenameable( 0, true );
-		setRenameable( 1, true );
-		setRenameable( 2, true );
-		setRenameable( 3, true );
-		setRenameable( 4, true );
-
-		typeComboBox = new KComboBox( viewport() );
-		typeComboBox->insertItem( typeComboBox->count(), i18nc("@item:inlistbox Unit type \
                other", "Other"));
-		typeComboBox->insertItem( typeComboBox->count(), i18nc("@item:inlistbox Unit type \
                mass", "Mass"));
-		typeComboBox->insertItem( typeComboBox->count(), i18nc("@item:inlistbox Unit type \
                volume", "Volume"));
-		addChild( typeComboBox );
-		typeComboBox->hide();
-
-		connect( typeComboBox, SIGNAL( activated(int) ), SLOT( updateType(int) ) );
-		connect( this, SIGNAL( selectionChanged() ), SLOT( hideTypeCombo() ) );
-	}
-}
-
-void StdUnitListView::insertTypeComboBox( Q3ListViewItem* it )
-{
-	QRect r;
-
-	// Constraints Box1
-	r = header() ->sectionRect( 4 ); //start at the section 2 header
-	r.translate( 0, itemRect( it ).y() ); //Move down to the item, note that its height \
                is same as header's right now.
-
-	r.setHeight( it->height() ); // Set the item's height
-	r.setWidth( header() ->sectionRect( 4 ).width() ); // and width
-	typeComboBox->setGeometry( r );
-
-	UnitListViewItem *unit_it = (UnitListViewItem*)it;
-	typeComboBox->setCurrentIndex( unit_it->unit().type() );
-
-	typeComboBox->show();
-}
-
-void StdUnitListView::updateType( int type )
-{
-	UnitListViewItem *unit_it = (UnitListViewItem*)currentItem();
-	unit_it->setType((Unit::Type)type);
-
-	database->modUnit( unit_it->unit() );
-}
-
-void StdUnitListView::hideTypeCombo()
-{
-	typeComboBox->hide();
-}
-
-void StdUnitListView::createUnit( const Unit &unit )
-{
-	createElement(new UnitListViewItem( this, unit ));
-}
-
-void StdUnitListView::removeUnit( int id )
-{
-	Q3ListViewItem * item = findItem( QString::number( id ), 5 );
-	removeElement(item);
-}
-
-#include "unitlistview.moc"
diff --git a/src/widgets/unitlistview.h b/src/widgets/unitlistview.h
deleted file mode 100644
index d77ad5d..0000000
--- a/src/widgets/unitlistview.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/***************************************************************************
-*   Copyright  © 2004 Unai Garro <ugarro@gmail.com>                        *
-*   Copyright  © 2004 Cyril Bosselut <bosselut@b1project.com>              *
-*   Copyright  © 2004 Jason Kivlighn <jkivlighn@gmail.com>                 *
-*                                                                         *
-*   This program is free software; you can redistribute it and/or modify  *
-*   it under the terms of the GNU General Public License as published by  *
-*   the Free Software Foundation; either version 2 of the License, or     *
-*   (at your option) any later version.                                   *
-***************************************************************************/
-
-#ifndef UNITLISTVIEW_H
-#define UNITLISTVIEW_H
-
-#include <KLocale>
-
-#include "dblistviewbase.h"
-
-#include "datablocks/unit.h"
-
-class KComboBox;
-
-class RecipeDB;
-class KMenu;
-
-class UnitListView : public DBListViewBase
-{
-	Q_OBJECT
-
-public:
-	UnitListView( QWidget *parent, RecipeDB *db );
-
-public slots:
-	virtual void load( int curr_limit, int curr_offset );
-
-protected slots:
-	virtual void createUnit( const Unit & ) = 0;
-	virtual void removeUnit( int ) = 0;
-
-	void checkCreateUnit( const Unit &el );
-};
-
-class StdUnitListView : public UnitListView
-{
-	Q_OBJECT
-
-public:
-	StdUnitListView( QWidget *parent, RecipeDB *db, bool editable = false );
-
-	void insertTypeComboBox( Q3ListViewItem* );
-
-protected:
-	virtual void createUnit( const Unit & );
-	virtual void removeUnit( int );
-
-private slots:
-	void hideTypeCombo();
-	void updateType( int type );
-
-private:
-	KComboBox *typeComboBox;
-};
-
-class UnitListViewItem : public Q3ListViewItem
-{
-public:
-	UnitListViewItem( Q3ListView* qlv, const Unit &u ) : Q3ListViewItem( qlv ), \
                m_unit(u)
-	{
-		updateType(m_unit.type());
-	}
-
-	virtual QString text( int column ) const
-	{
-		switch ( column ) {
-		case 0: return m_unit.name();
-		case 1: return m_unit.nameAbbrev();
-		case 2: return m_unit.plural();
-		case 3: return m_unit.pluralAbbrev();
-		case 4: return m_type;
-		case 5: return QString::number(m_unit.id());
-		default: return QString();
-		}
-	}
-
-	void setType( Unit::Type type ){ m_unit.setType(type); updateType(type); }
-	Unit::Type type(){ return m_unit.type(); }
-
-	Unit unit() const { return m_unit; };
-	void setUnit( const Unit &u ) { m_unit = u; }
-
-protected:
-	virtual void setText( int column, const QString &text ) {
-		switch ( column ) {
-		case 0: m_unit.setName(text); break;
-		case 1: m_unit.setNameAbbrev(text); break;
-		case 2: m_unit.setPlural(text); break;
-		case 3: m_unit.setPluralAbbrev(text); break;
-		}
-	}
-
-private:
-	void updateType( Unit::Type t ) {
-		switch ( t ) {
-		case Unit::Other: m_type = i18nc("Unit type other", "Other"); break;
-		case Unit::Mass: m_type = i18nc("Unit type mass", "Mass"); break;
-		case Unit::Volume: m_type = i18nc("Unit type volume", "Volume"); break;
-		default: break;
-		}
-	}
-
-	Unit m_unit;
-	QString m_type;
-};
-
-#endif //UNITLISTVIEW_H


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic