summaryrefslogtreecommitdiffstats
path: root/krecipes/src/widgets/categorylistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krecipes/src/widgets/categorylistview.cpp')
-rw-r--r--krecipes/src/widgets/categorylistview.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/krecipes/src/widgets/categorylistview.cpp b/krecipes/src/widgets/categorylistview.cpp
index 35186a7..c243d48 100644
--- a/krecipes/src/widgets/categorylistview.cpp
+++ b/krecipes/src/widgets/categorylistview.cpp
@@ -25,7 +25,7 @@
#include "dialogs/createcategorydialog.h"
#include "dialogs/dependanciesdialog.h"
-CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, const Element &category, bool _exclusive ) : QCheckListItem( klv, QString::null, QCheckListItem::CheckBox ), CategoryItemInfo( category ),
+CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, const Element &category, bool _exclusive ) : TQCheckListItem( klv, TQString::null, TQCheckListItem::CheckBox ), CategoryItemInfo( category ),
locked( false ),
exclusive( _exclusive ),
m_listview(klv)
@@ -33,7 +33,7 @@ CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, const
setOn( false ); // Set unchecked by default
}
-CategoryCheckListItem::CategoryCheckListItem( QListViewItem* it, const Element &category, bool _exclusive ) : QCheckListItem( it, QString::null, QCheckListItem::CheckBox ), CategoryItemInfo( category ),
+CategoryCheckListItem::CategoryCheckListItem( TQListViewItem* it, const Element &category, bool _exclusive ) : TQCheckListItem( it, TQString::null, TQCheckListItem::CheckBox ), CategoryItemInfo( category ),
locked( false ),
exclusive( _exclusive ),
m_listview((CategoryCheckListView*)it->listView())
@@ -41,7 +41,7 @@ CategoryCheckListItem::CategoryCheckListItem( QListViewItem* it, const Element &
setOn( false ); // Set unchecked by default
}
-CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, QListViewItem* it, const Element &category, bool _exclusive ) : QCheckListItem( klv, it, QString::null, QCheckListItem::CheckBox ), CategoryItemInfo( category ),
+CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, TQListViewItem* it, const Element &category, bool _exclusive ) : TQCheckListItem( klv, it, TQString::null, TQCheckListItem::CheckBox ), CategoryItemInfo( category ),
locked( false ),
exclusive( _exclusive ),
m_listview(klv)
@@ -49,15 +49,15 @@ CategoryCheckListItem::CategoryCheckListItem( CategoryCheckListView* klv, QListV
setOn( false ); // Set unchecked by default
}
-QString CategoryCheckListItem::text( int column ) const
+TQString CategoryCheckListItem::text( int column ) const
{
if ( column == 1 )
- return ( QString::number( ctyStored.id ) );
+ return ( TQString::number( ctyStored.id ) );
else
return ( ctyStored.name );
}
-void CategoryCheckListItem::setText( int column, const QString &text )
+void CategoryCheckListItem::setText( int column, const TQString &text )
{
switch ( column ) {
case 0:
@@ -108,27 +108,27 @@ void CategoryCheckListItem::setParentsState( bool on )
-CategoryListItem::CategoryListItem( QListView* klv, const Element &category ) : QListViewItem( klv ),
+CategoryListItem::CategoryListItem( TQListView* klv, const Element &category ) : TQListViewItem( klv ),
CategoryItemInfo(category)
{}
-CategoryListItem::CategoryListItem( QListViewItem* it, const Element &category ) : QListViewItem( it ),
+CategoryListItem::CategoryListItem( TQListViewItem* it, const Element &category ) : TQListViewItem( it ),
CategoryItemInfo(category)
{}
-CategoryListItem::CategoryListItem( QListView* klv, QListViewItem* it, const Element &category ) : QListViewItem( klv, it ),
+CategoryListItem::CategoryListItem( TQListView* klv, TQListViewItem* it, const Element &category ) : TQListViewItem( klv, it ),
CategoryItemInfo(category)
{}
-QString CategoryListItem::text( int column ) const
+TQString CategoryListItem::text( int column ) const
{
if ( column == 1 )
- return ( QString::number( ctyStored.id ) );
+ return ( TQString::number( ctyStored.id ) );
else
return ( ctyStored.name );
}
-void CategoryListItem::setText( int column, const QString &text )
+void CategoryListItem::setText( int column, const TQString &text )
{
if ( column == 0 )
ctyStored.name = text;
@@ -136,18 +136,18 @@ void CategoryListItem::setText( int column, const QString &text )
-CategoryListView::CategoryListView( QWidget *parent, RecipeDB *db ) : DBListViewBase( parent, db, db->categoryTopLevelCount() ),
+CategoryListView::CategoryListView( TQWidget *parent, RecipeDB *db ) : DBListViewBase( parent, db, db->categoryTopLevelCount() ),
m_item_to_delete(0)
{
- //connect( this, SIGNAL( spacePressed(QListViewItem*) ), SLOT( open(QListViewItem*) ) );
- //connect( this, SIGNAL( returnPressed(QListViewItem*) ), SLOT( open(QListViewItem*) ) );
- //connect( this, SIGNAL( executed(QListViewItem*) ), SLOT( open(QListViewItem*) ) );
+ //connect( this, SIGNAL( spacePressed(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) );
+ //connect( this, SIGNAL( returnPressed(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) );
+ //connect( this, SIGNAL( executed(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) );
- connect( this, SIGNAL( expanded(QListViewItem*) ), SLOT( open(QListViewItem*) ) );
+ connect( this, SIGNAL( expanded(TQListViewItem*) ), SLOT( open(TQListViewItem*) ) );
setRootIsDecorated( true );
setAllColumnsShowFocus( true );
- setDefaultRenameAction( QListView::Reject );
+ setDefaultRenameAction( TQListView::Reject );
}
void CategoryListView::init()
@@ -175,7 +175,7 @@ void CategoryListView::load( int limit, int offset )
}
}
-void CategoryListView::populate( QListViewItem *item )
+void CategoryListView::populate( TQListViewItem *item )
{
CategoryItemInfo *cat_item = dynamic_cast<CategoryItemInfo*>(item);
if ( !cat_item || cat_item->isPopulated() ) return;
@@ -196,19 +196,19 @@ void CategoryListView::populate( QListViewItem *item )
}
}
-void CategoryListView::populateAll( QListViewItem *parent )
+void CategoryListView::populateAll( TQListViewItem *parent )
{
if ( !parent )
parent = firstChild();
- for ( QListViewItem *item = parent; item; item = item->nextSibling() ) {
+ for ( TQListViewItem *item = parent; item; item = item->nextSibling() ) {
populate( item );
if ( item->firstChild() )
populateAll( item->firstChild() );
}
}
-void CategoryListView::open( QListViewItem *item )
+void CategoryListView::open( TQListViewItem *item )
{
Q_ASSERT( item );
if ( !item->firstChild() || item->firstChild()->rtti() != PSEUDOLISTITEM_RTTI ) return;
@@ -227,7 +227,7 @@ void CategoryListView::checkCreateCategory( const Element &el, int parent_id )
void CategoryListView::modifyCategory( const Element &category )
{
- QListViewItem * item = items_map[ category.id ];
+ TQListViewItem * item = items_map[ category.id ];
if ( item )
item->setText( 0, category.name );
@@ -235,9 +235,9 @@ void CategoryListView::modifyCategory( const Element &category )
void CategoryListView::modifyCategory( int id, int parent_id )
{
- QMap<int,QListViewItem*>::iterator item_it = items_map.find(id);
+ TQMap<int,TQListViewItem*>::iterator item_it = items_map.find(id);
if ( item_it != items_map.end() ) {
- QListViewItem *item = *item_it;
+ TQListViewItem *item = *item_it;
Q_ASSERT( item );
removeElement(item,false);
@@ -251,7 +251,7 @@ void CategoryListView::modifyCategory( int id, int parent_id )
createElement(item);
}
else {
- QMap<int,QListViewItem*>::iterator parent_item_it = items_map.find(parent_id);
+ TQMap<int,TQListViewItem*>::iterator parent_item_it = items_map.find(parent_id);
if ( parent_item_it != items_map.end() &&
dynamic_cast<CategoryItemInfo*>(*parent_item_it)->isPopulated() ) {
(*parent_item_it)->insertItem( item );
@@ -272,15 +272,15 @@ void CategoryListView::modifyCategory( int id, int parent_id )
void CategoryListView::mergeCategories( int id1, int id2 )
{
- QListViewItem * to_item = items_map[ id1 ];
- QListViewItem *from_item = items_map[ id2 ];
+ TQListViewItem * to_item = items_map[ id1 ];
+ TQListViewItem *from_item = items_map[ id2 ];
CategoryItemInfo *info_item = dynamic_cast<CategoryItemInfo*>(to_item);
if ( to_item && info_item->isPopulated() && from_item ) {
//note that this takes care of any recipes that may be children as well
- QListViewItem *next_sibling;
- for ( QListViewItem * it = from_item->firstChild(); it; it = next_sibling ) {
+ TQListViewItem *next_sibling;
+ for ( TQListViewItem * it = from_item->firstChild(); it; it = next_sibling ) {
next_sibling = it->nextSibling(); //get the sibling before we move the item
removeElement(it,false);
@@ -295,7 +295,7 @@ void CategoryListView::mergeCategories( int id1, int id2 )
}
-StdCategoryListView::StdCategoryListView( QWidget *parent, RecipeDB *db, bool editable ) : CategoryListView( parent, db ),
+StdCategoryListView::StdCategoryListView( TQWidget *parent, RecipeDB *db, bool editable ) : CategoryListView( parent, db ),
clipboard_item( 0 ),
clipboard_parent( 0 )
{
@@ -327,10 +327,10 @@ StdCategoryListView::StdCategoryListView( QWidget *parent, RecipeDB *db, bool ed
delete il;
connect( kpop, SIGNAL( aboutToShow() ), SLOT( preparePopup() ) );
- connect( this, SIGNAL( contextMenu( KListView *, QListViewItem *, const QPoint & ) ), SLOT( showPopup( KListView *, QListViewItem *, const QPoint & ) ) );
- connect( this, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), SLOT( modCategory( QListViewItem* ) ) );
- connect( this, SIGNAL( itemRenamed ( QListViewItem* ) ), SLOT( saveCategory( QListViewItem* ) ) );
- connect( this, SIGNAL( moved( QListViewItem *, QListViewItem *, QListViewItem * ) ), SLOT( changeCategoryParent( QListViewItem *, QListViewItem *, QListViewItem * ) ) );
+ connect( this, SIGNAL( contextMenu( KListView *, TQListViewItem *, const TQPoint & ) ), SLOT( showPopup( KListView *, TQListViewItem *, const TQPoint & ) ) );
+ connect( this, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), SLOT( modCategory( TQListViewItem* ) ) );
+ connect( this, SIGNAL( itemRenamed ( TQListViewItem* ) ), SLOT( saveCategory( TQListViewItem* ) ) );
+ connect( this, SIGNAL( moved( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ), SLOT( changeCategoryParent( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ) );
}
}
@@ -339,7 +339,7 @@ StdCategoryListView::~StdCategoryListView()
delete clipboard_item;
}
-void StdCategoryListView::setPixmap( const QPixmap &icon )
+void StdCategoryListView::setPixmap( const TQPixmap &icon )
{
m_folder_icon = icon;
}
@@ -351,7 +351,7 @@ void StdCategoryListView::preparePopup()
kpop->setItemEnabled( kpop->idAt( 6 ), clipboard_item );
}
-void StdCategoryListView::showPopup( KListView * /*l*/, QListViewItem *i, const QPoint &p )
+void StdCategoryListView::showPopup( KListView * /*l*/, TQListViewItem *i, const TQPoint &p )
{
if ( i )
kpop->exec( p );
@@ -363,8 +363,8 @@ void StdCategoryListView::createNew()
database->loadCategories( &categories );
CreateCategoryDialog* categoryDialog = new CreateCategoryDialog( this, categories );
- if ( categoryDialog->exec() == QDialog::Accepted ) {
- QString result = categoryDialog->newCategoryName();
+ if ( categoryDialog->exec() == TQDialog::Accepted ) {
+ TQString result = categoryDialog->newCategoryName();
int subcategory = categoryDialog->subcategory();
//check bounds first
@@ -377,7 +377,7 @@ void StdCategoryListView::createNew()
void StdCategoryListView::remove
()
{
- QListViewItem * item = currentItem();
+ TQListViewItem * item = currentItem();
if ( item ) {
int id = item->text( 1 ).toInt();
@@ -399,7 +399,7 @@ void StdCategoryListView::remove
info.name = i18n("Recipes");
DependanciesDialog warnDialog( this, info, false );
- if ( warnDialog.exec() == QDialog::Accepted )
+ if ( warnDialog.exec() == TQDialog::Accepted )
database->removeCategory( id );
}
}
@@ -407,7 +407,7 @@ void StdCategoryListView::remove
void StdCategoryListView::rename()
{
- QListViewItem * item = currentItem();
+ TQListViewItem * item = currentItem();
if ( item )
CategoryListView::rename( item, 0 );
@@ -424,7 +424,7 @@ void StdCategoryListView::cut()
clipboard_item = 0;
}
- QListViewItem *item = currentItem();
+ TQListViewItem *item = currentItem();
if ( item ) {
clipboard_item = item;
@@ -439,7 +439,7 @@ void StdCategoryListView::cut()
void StdCategoryListView::paste()
{
- QListViewItem * item = currentItem();
+ TQListViewItem * item = currentItem();
if ( item && clipboard_item ) {
if ( item->parent() )
item->parent() ->insertItem( clipboard_item );
@@ -453,7 +453,7 @@ void StdCategoryListView::paste()
void StdCategoryListView::pasteAsSub()
{
- QListViewItem * item = currentItem();
+ TQListViewItem * item = currentItem();
if ( item && clipboard_item ) {
item->insertItem( clipboard_item );
@@ -462,22 +462,22 @@ void StdCategoryListView::pasteAsSub()
}
}
-void StdCategoryListView::changeCategoryParent( QListViewItem *item, QListViewItem * /*afterFirst*/, QListViewItem * /*afterNow*/ )
+void StdCategoryListView::changeCategoryParent( TQListViewItem *item, TQListViewItem * /*afterFirst*/, TQListViewItem * /*afterNow*/ )
{
int new_parent_id = -1;
- if ( QListViewItem * parent = item->parent() )
+ if ( TQListViewItem * parent = item->parent() )
new_parent_id = parent->text( 1 ).toInt();
int cat_id = item->text( 1 ).toInt();
- disconnect( SIGNAL( moved( QListViewItem *, QListViewItem *, QListViewItem * ) ) );
+ disconnect( SIGNAL( moved( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ) );
database->modCategory( cat_id, new_parent_id );
- connect( this, SIGNAL( moved( QListViewItem *, QListViewItem *, QListViewItem * ) ), SLOT( changeCategoryParent( QListViewItem *, QListViewItem *, QListViewItem * ) ) );
+ connect( this, SIGNAL( moved( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ), SLOT( changeCategoryParent( TQListViewItem *, TQListViewItem *, TQListViewItem * ) ) );
}
void StdCategoryListView::removeCategory( int id )
{
- QListViewItem * item = items_map[ id ];
+ TQListViewItem * item = items_map[ id ];
items_map.remove( id );
removeElement(item);
@@ -505,7 +505,7 @@ void StdCategoryListView::createCategory( const Element &category, int parent_id
if ( new_item ) {
items_map.insert( category.id, new_item );
new_item->setPixmap( 0, m_folder_icon );
- createElement(new_item);//new QListViewItem(new_item);
+ createElement(new_item);//new TQListViewItem(new_item);
CategoryTree list;
CategoryTree *p_list = &list;
@@ -516,13 +516,13 @@ void StdCategoryListView::createCategory( const Element &category, int parent_id
}
}
-void StdCategoryListView::modCategory( QListViewItem* i )
+void StdCategoryListView::modCategory( TQListViewItem* i )
{
if ( i )
CategoryListView::rename( i, 0 );
}
-void StdCategoryListView::saveCategory( QListViewItem* i )
+void StdCategoryListView::saveCategory( TQListViewItem* i )
{
CategoryListItem * cat_it = ( CategoryListItem* ) i;
@@ -550,10 +550,10 @@ void StdCategoryListView::saveCategory( QListViewItem* i )
database->modCategory( cat_id, cat_it->categoryName() );
}
-bool StdCategoryListView::checkBounds( const QString &name )
+bool StdCategoryListView::checkBounds( const TQString &name )
{
if ( name.length() > uint(database->maxCategoryNameLength()) ) {
- KMessageBox::error( this, QString( i18n( "Category name cannot be longer than %1 characters." ) ).arg( database->maxCategoryNameLength() ) );
+ KMessageBox::error( this, TQString( i18n( "Category name cannot be longer than %1 characters." ) ).arg( database->maxCategoryNameLength() ) );
return false;
}
@@ -562,7 +562,7 @@ bool StdCategoryListView::checkBounds( const QString &name )
-CategoryCheckListView::CategoryCheckListView( QWidget *parent, RecipeDB *db, bool _exclusive, const ElementList &init_items_checked ) : CategoryListView( parent, db ),
+CategoryCheckListView::CategoryCheckListView( TQWidget *parent, RecipeDB *db, bool _exclusive, const ElementList &init_items_checked ) : CategoryListView( parent, db ),
exclusive(_exclusive)
{
addColumn( i18n( "Category" ) );
@@ -578,7 +578,7 @@ CategoryCheckListView::CategoryCheckListView( QWidget *parent, RecipeDB *db, boo
void CategoryCheckListView::removeCategory( int id )
{
- QListViewItem * item = items_map[ id ];
+ TQListViewItem * item = items_map[ id ];
items_map.remove( id );
removeElement(item);
@@ -591,7 +591,7 @@ void CategoryCheckListView::createCategory( const Element &category, int parent_
new_item = new CategoryCheckListItem( this, category, exclusive );
}
else {
- QListViewItem *parent = items_map[ parent_id ];
+ TQListViewItem *parent = items_map[ parent_id ];
if ( parent )
new_item = new CategoryCheckListItem( parent, category, exclusive );
}
@@ -626,8 +626,8 @@ void CategoryCheckListView::load( int limit, int offset )
{
CategoryListView::load(limit,offset);
- for ( QValueList<Element>::const_iterator it = m_selections.begin(); it != m_selections.end(); ++it ) {
- QCheckListItem * item = ( QCheckListItem* ) findItem( QString::number( (*it).id ), 1 );
+ for ( TQValueList<Element>::const_iterator it = m_selections.begin(); it != m_selections.end(); ++it ) {
+ TQCheckListItem * item = ( TQCheckListItem* ) findItem( TQString::number( (*it).id ), 1 );
if ( item ) {
item->setOn(true);
}