TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

boxcontainer.cpp 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "boxcontainer.h"
  19. #include "boxcontaineritem.h"
  20. #include <tdeconfig.h>
  21. #include <kdebug.h>
  22. #include <tqptrlist.h>
  23. BoxContainer::BoxContainer( TQObject * parent, const char * name )
  24. : TQObject( parent, name ),
  25. _items( new TQPtrList< BoxContainerItem > )
  26. {
  27. _items->setAutoDelete( true );
  28. }
  29. BoxContainer::~BoxContainer()
  30. {
  31. delete _items;
  32. }
  33. void BoxContainer::readConfig( TDEConfig* config )
  34. {
  35. int counter = 0;
  36. while( config->hasGroup( TQString( "korn-%1" ).arg( counter ) ) )
  37. {
  38. config->setGroup( TQString( "korn-%1" ).arg( counter ) );
  39. BoxContainerItem *item = newBoxInstance();
  40. item->readConfig( config, counter );
  41. addItem( item );
  42. ++counter;
  43. }
  44. }
  45. void BoxContainer::writeConfig( TDEConfig *config )
  46. {
  47. int index = 0;
  48. BoxContainerItem *item;
  49. for ( item = _items->first(); item; item = _items->next() )
  50. {
  51. item->writeConfig( config, index );
  52. ++index;
  53. }
  54. }
  55. void BoxContainer::showBox()
  56. {
  57. BoxContainerItem *item;
  58. for( item = _items->first(); item; item = _items->next() )
  59. item->showBox();
  60. }
  61. void BoxContainer::slotShowConfiguration()
  62. {
  63. emit showConfiguration();
  64. }
  65. void BoxContainer::addItem( BoxContainerItem* item )
  66. {
  67. connect( item, TQT_SIGNAL( showConfiguration() ), this, TQT_SLOT( slotShowConfiguration() ) );
  68. _items->append( item );
  69. }
  70. #include "boxcontainer.moc"