Diffstat (limited to 'noncore/net/opieirc/ircservereditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircservereditor.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp index 798081f..c3a444d 100644 --- a/noncore/net/opieirc/ircservereditor.cpp +++ b/noncore/net/opieirc/ircservereditor.cpp @@ -5,5 +5,5 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags f) : QDialog(parent, name, modal, f) { - QGridLayout *layout = new QGridLayout(this, 6, 2, 5, 5); + QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5); QLabel *label = new QLabel(tr("Profile name :"), this); m_name = new QLineEdit(server.name(), this); @@ -30,4 +30,8 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* layout->addWidget(label, 5, 0); layout->addWidget(m_password, 5, 1); + label = new QLabel(tr("Channels :"), this); + m_channels = new QLineEdit(server.channels(), this); + layout->addWidget(label, 6, 0); + layout->addWidget(m_channels, 6, 1); showMaximized(); } @@ -45,6 +49,16 @@ void IRCServerEditor::accept() { else if (m_realname->text().length()==0) QMessageBox::critical(this, tr("Error"), tr("Realname required")); - else + else { + /* Now verify whether the channel list has a valid format */ + QStringList channels = QStringList::split(QChar(','), m_channels->text()); + for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { + QString channelName = (*it).stripWhiteSpace(); + if (!channelName.startsWith("#")) { + QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with '#'")); + return; + } + } QDialog::accept(); + } } @@ -58,4 +72,5 @@ IRCServer IRCServerEditor::getServer() { server.setUsername(m_nickname->text()); server.setPassword(m_password->text()); + server.setChannels(m_channels->text()); return server; } |