/*
  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.
*/

/*
  begin:     Don Nov 21 2002
  copyright: (C) 2002 by Dario Abatianni
  email:     eisfuchs@tigress.com
*/

#include "topiccombobox.h"


TopicComboBox::TopicComboBox(TQWidget* parent) :
KComboBox(parent,"topic_combo_box")
{
    connect(this,TQ_SIGNAL(activated(int)),this,TQ_SLOT(topicActivated(int)));
    connect(this,TQ_SIGNAL(returnPressed(const TQString&)),this,TQ_SLOT(topicActivated(const TQString&)));
}

TopicComboBox::~TopicComboBox()
{
}

void TopicComboBox::topicActivated(const TQString& newTopic)
{
    emit topicChanged(newTopic);
}

void TopicComboBox::topicActivated(int index)
{
    emit topicChanged(text(index).section(' ',1));
}

void TopicComboBox::insertStringList(const TQStringList& list)
{
    KComboBox::insertStringList(list);

    setEditText(list[0].section(' ',1));
}

void TopicComboBox::wheelEvent(TQWheelEvent *ev)
{
    ev->ignore();
}

#include "topiccombobox.moc"
