/* museeq - a Qt client to museekd
 *
 * Copyright (C) 2003-2004 Hyriand <hyriand@thegraveyard.org>
 *
 * 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 the 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
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "roomlist.h"

#include <qlabel.h>
#include <qhbox.h>
#include <qlineedit.h>
#include "roomlistview.h"
#include "museeq.h"

RoomList::RoomList(QWidget* _p, const char* _n)
         : QVBox(_p, _n) {
	
	mRoomList = new RoomListView(this);
	
	QHBox *box = new QHBox(this);
	new QLabel(tr("Create:"), box);
	
	mEntry = new QLineEdit(box);
	connect(mEntry, SIGNAL(returnPressed()), SLOT(slotJoinRoom()));
}

void RoomList::slotJoinRoom() {
	QString s = mEntry->text();
	if(s.isEmpty())
		return;
	mEntry->setText(QString::null);
	museeq->joinRoom(s);
}

void RoomList::showEvent(QShowEvent*) {
	mEntry->setFocus();
}
