2002-07-17 14:21:33 +00:00
|
|
|
//
|
2005-09-20 10:04:09 +00:00
|
|
|
// Copyright (C) 1998-2005 Matthias Hoelzer
|
2002-07-17 14:21:33 +00:00
|
|
|
// email: hoelzer@physik.uni-wuerzburg.de
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the7 implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2005-10-05 08:44:32 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-07-17 14:21:33 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include <qlabel.h>
|
2005-07-28 14:59:42 +00:00
|
|
|
#include <q3listbox.h>
|
2005-10-22 15:50:50 +00:00
|
|
|
#include <kvbox.h>
|
2002-07-17 14:21:33 +00:00
|
|
|
|
|
|
|
#include "klistboxdialog.h"
|
|
|
|
#include "klistboxdialog.moc"
|
|
|
|
|
|
|
|
#include "klocale.h"
|
|
|
|
|
2005-09-20 10:04:09 +00:00
|
|
|
KListBoxDialog::KListBoxDialog(const QString &text, QWidget *parent)
|
2006-01-02 17:28:18 +00:00
|
|
|
: KDialogBase( parent, 0, true, QString(), Ok|Cancel, Ok, true )
|
2002-07-17 14:21:33 +00:00
|
|
|
{
|
2005-10-22 10:44:47 +00:00
|
|
|
KVBox *page = makeVBoxMainWidget();
|
2002-07-17 14:21:33 +00:00
|
|
|
|
|
|
|
label = new QLabel(text, page);
|
2005-07-28 14:59:42 +00:00
|
|
|
label->setAlignment(Qt::AlignCenter);
|
2002-07-17 14:21:33 +00:00
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
table = new Q3ListBox(page);
|
2005-05-04 15:03:09 +00:00
|
|
|
table->setFocus();
|
2002-07-17 14:21:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KListBoxDialog::insertItem(const QString& item)
|
|
|
|
{
|
|
|
|
table->insertItem(item);
|
|
|
|
table->setCurrentItem(0);
|
|
|
|
}
|
|
|
|
|
2004-08-13 23:43:49 +00:00
|
|
|
void KListBoxDialog::setCurrentItem(const QString& item)
|
|
|
|
{
|
|
|
|
for ( int i=0; i < (int) table->count(); i++ ) {
|
|
|
|
if ( table->text(i) == item ) {
|
|
|
|
table->setCurrentItem(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-17 14:21:33 +00:00
|
|
|
int KListBoxDialog::currentItem()
|
|
|
|
{
|
|
|
|
return table->currentItem();
|
|
|
|
}
|