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.
konversation/konversation/src/channeldialog.cpp

83 lines
2.2 KiB

/*
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.
copyright: (C) 2004 by Peter Simonsson
email: psn@linux.se
*/
#include "channeldialog.h"
#include "servergroupsettings.h"
#include <tqlayout.h>
#include <tqframe.h>
#include <tqlabel.h>
#include <tqlineedit.h>
#include <tdelocale.h>
#include <tdemessagebox.h>
namespace Konversation
{
ChannelDialog::ChannelDialog(const TQString& title, TQWidget *parent, const char *name)
: KDialogBase(Plain, title, Ok|Cancel, Ok, parent, name)
{
TQFrame* mainWidget = plainPage();
TQGridLayout* mainLayout = new TQGridLayout(mainWidget, 1, 2, 0, spacingHint());
TQLabel* channelLbl = new TQLabel(i18n("C&hannel:"), mainWidget);
m_channelEdit = new TQLineEdit(mainWidget);
m_channelEdit->setMaxLength(50);
channelLbl->setBuddy(m_channelEdit);
TQLabel* passwordLbl = new TQLabel(i18n("Pass&word:"), mainWidget);
m_passwordEdit = new TQLineEdit(mainWidget);
m_passwordEdit->setEchoMode(TQLineEdit::Password);
passwordLbl->setBuddy(m_passwordEdit);
mainLayout->addWidget(channelLbl, 0, 0);
mainLayout->addWidget(m_channelEdit, 0, 1);
mainLayout->addWidget(passwordLbl, 1, 0);
mainLayout->addWidget(m_passwordEdit, 1, 1);
m_channelEdit->setFocus();
}
ChannelDialog::~ChannelDialog()
{
}
void ChannelDialog::setChannelSettings(const ChannelSettings& channel)
{
m_channelEdit->setText(channel.name());
m_passwordEdit->setText(channel.password());
}
ChannelSettings ChannelDialog::channelSettings()
{
ChannelSettings channel;
channel.setName(m_channelEdit->text());
channel.setPassword(m_passwordEdit->text());
return channel;
}
void ChannelDialog::slotOk()
{
if (m_channelEdit->text().isEmpty())
{
KMessageBox::error(this, i18n("The channel name is required."));
}
else
{
accept();
}
}
}
#include "channeldialog.moc"