#include "newmusicbrainzdialog.h"
#include <kdebug.h>

NewMusicbrainzDialog::NewMusicbrainzDialog(QWidget *parent) : QDialog(parent)
{
   kDebug();
   setupUi(this);
   btnAdd->setDefault(true);
   
   connect(artistName, SIGNAL(textEdited(const QString&)), this, SLOT(artistTextChanged(const QString)));
   connect(btnAdd, SIGNAL(clicked()), this, SLOT(addClicked()));
}

void NewMusicbrainzDialog::addClicked()
{
   kDebug();
   this->searchText = this->artistName->text();
   this->done( QDialog::Accepted );
}


void NewMusicbrainzDialog::artistTextChanged(const QString &text)
{
   if (text.length()) {
      this->btnAdd->setEnabled( true );
   } else {
      this->btnAdd->setEnabled( false );
   }
}

QString NewMusicbrainzDialog::getSearchText()
{
   kDebug();
   return this->searchText;
}

NewMusicbrainzDialog::~NewMusicbrainzDialog()
{
   kDebug();
}

