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 | |||
@@ -3,9 +3,9 @@ | |||
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include "ircservereditor.h" | 4 | #include "ircservereditor.h" |
5 | 5 | ||
6 | IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags f) : QDialog(parent, name, modal, f) { | 6 | IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags f) : QDialog(parent, name, modal, f) { |
7 | QGridLayout *layout = new QGridLayout(this, 6, 2, 5, 5); | 7 | QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5); |
8 | QLabel *label = new QLabel(tr("Profile name :"), this); | 8 | QLabel *label = new QLabel(tr("Profile name :"), this); |
9 | m_name = new QLineEdit(server.name(), this); | 9 | m_name = new QLineEdit(server.name(), this); |
10 | layout->addWidget(label, 0, 0); | 10 | layout->addWidget(label, 0, 0); |
11 | layout->addWidget(m_name, 0, 1); | 11 | layout->addWidget(m_name, 0, 1); |
@@ -28,8 +28,12 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* | |||
28 | label = new QLabel(tr("Password :"), this); | 28 | label = new QLabel(tr("Password :"), this); |
29 | m_password = new QLineEdit(server.password(), this); | 29 | m_password = new QLineEdit(server.password(), this); |
30 | layout->addWidget(label, 5, 0); | 30 | layout->addWidget(label, 5, 0); |
31 | layout->addWidget(m_password, 5, 1); | 31 | layout->addWidget(m_password, 5, 1); |
32 | label = new QLabel(tr("Channels :"), this); | ||
33 | m_channels = new QLineEdit(server.channels(), this); | ||
34 | layout->addWidget(label, 6, 0); | ||
35 | layout->addWidget(m_channels, 6, 1); | ||
32 | showMaximized(); | 36 | showMaximized(); |
33 | } | 37 | } |
34 | 38 | ||
35 | 39 | ||
@@ -43,10 +47,20 @@ void IRCServerEditor::accept() { | |||
43 | else if (m_nickname->text().length()==0) | 47 | else if (m_nickname->text().length()==0) |
44 | QMessageBox::critical(this, tr("Error"), tr("Nickname required")); | 48 | QMessageBox::critical(this, tr("Error"), tr("Nickname required")); |
45 | else if (m_realname->text().length()==0) | 49 | else if (m_realname->text().length()==0) |
46 | QMessageBox::critical(this, tr("Error"), tr("Realname required")); | 50 | QMessageBox::critical(this, tr("Error"), tr("Realname required")); |
47 | else | 51 | else { |
52 | /* Now verify whether the channel list has a valid format */ | ||
53 | QStringList channels = QStringList::split(QChar(','), m_channels->text()); | ||
54 | for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { | ||
55 | QString channelName = (*it).stripWhiteSpace(); | ||
56 | if (!channelName.startsWith("#")) { | ||
57 | QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with '#'")); | ||
58 | return; | ||
59 | } | ||
60 | } | ||
48 | QDialog::accept(); | 61 | QDialog::accept(); |
62 | } | ||
49 | } | 63 | } |
50 | 64 | ||
51 | IRCServer IRCServerEditor::getServer() { | 65 | IRCServer IRCServerEditor::getServer() { |
52 | IRCServer server; | 66 | IRCServer server; |
@@ -56,6 +70,7 @@ IRCServer IRCServerEditor::getServer() { | |||
56 | server.setNick(m_nickname->text()); | 70 | server.setNick(m_nickname->text()); |
57 | server.setRealname(m_realname->text()); | 71 | server.setRealname(m_realname->text()); |
58 | server.setUsername(m_nickname->text()); | 72 | server.setUsername(m_nickname->text()); |
59 | server.setPassword(m_password->text()); | 73 | server.setPassword(m_password->text()); |
74 | server.setChannels(m_channels->text()); | ||
60 | return server; | 75 | return server; |
61 | } | 76 | } |