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.
73 lines
1.8 KiB
73 lines
1.8 KiB
/****************************************************************************
|
|
** ui.h extension file, included from the uic-generated form implementation.
|
|
**
|
|
** If you wish to add, delete or rename slots use TQt Designer which will
|
|
** update this file, preserving your code. Create an init() slot in place of
|
|
** a constructor, and a destroy() slot in place of a destructor.
|
|
*****************************************************************************/
|
|
|
|
#include <ntqheader.h>
|
|
#include <ntqapplication.h>
|
|
|
|
void ListEditor::init()
|
|
{
|
|
listview->header()->hide();
|
|
listview->setSorting( -1 );
|
|
listview->setDefaultRenameAction( TQListView::Accept );
|
|
}
|
|
|
|
void ListEditor::setList( const TQStringList &l )
|
|
{
|
|
TQListViewItem *i = 0;
|
|
for ( TQStringList::ConstIterator it = l.begin(); it != l.end(); ++it ) {
|
|
i = new TQListViewItem( listview, i );
|
|
i->setText( 0, *it );
|
|
i->setRenameEnabled( 0, TRUE );
|
|
}
|
|
}
|
|
|
|
void ListEditor::addItem()
|
|
{
|
|
TQListViewItem *i = new TQListViewItem( listview, listview->lastItem() );
|
|
i->setRenameEnabled( 0, TRUE );
|
|
tqApp->processEvents();
|
|
i->startRename( 0 );
|
|
}
|
|
|
|
void ListEditor::renamed( TQListViewItem *i )
|
|
{
|
|
if ( i && i->text( 0 ).isEmpty() )
|
|
i->startRename( 0 );
|
|
}
|
|
|
|
void ListEditor::removeItems()
|
|
{
|
|
TQListViewItemIterator it( listview );
|
|
TQListViewItem *i = 0;
|
|
while ( ( i = it.current() ) ) {
|
|
++it;
|
|
if ( i->isSelected() )
|
|
delete i;
|
|
}
|
|
}
|
|
|
|
TQStringList ListEditor::items()
|
|
{
|
|
TQStringList l;
|
|
TQListViewItemIterator it( listview );
|
|
TQListViewItem *i = 0;
|
|
while ( ( i = it.current() ) ) {
|
|
++it;
|
|
if ( !i->text( 0 ).isEmpty() )
|
|
l << i->text( 0 );
|
|
}
|
|
return l;
|
|
}
|
|
|
|
void ListEditor::renameItem()
|
|
{
|
|
TQListViewItem *i = listview->currentItem();
|
|
if ( i )
|
|
i->startRename( 0 );
|
|
}
|