Diffstat (limited to 'noncore/net/opieirc/ircservereditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircservereditor.cpp | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp index 1b157d6..798081f 100644 --- a/noncore/net/opieirc/ircservereditor.cpp +++ b/noncore/net/opieirc/ircservereditor.cpp @@ -1 +1,2 @@ +#include <qmessagebox.h> #include <qlayout.h> @@ -6,18 +7,18 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* QGridLayout *layout = new QGridLayout(this, 6, 2, 5, 5); - QLabel *label = new QLabel(tr("Hostname :"), this); - m_hostname = new QLineEdit(server.hostname(), this); + QLabel *label = new QLabel(tr("Profile name :"), this); + m_name = new QLineEdit(server.name(), this); layout->addWidget(label, 0, 0); - layout->addWidget(m_hostname, 0, 1); + layout->addWidget(m_name, 0, 1); + label = new QLabel(tr("Hostname :"), this); + m_hostname = new QLineEdit(server.hostname(), this); + layout->addWidget(label, 1, 0); + layout->addWidget(m_hostname, 1, 1); label = new QLabel(tr("Port :"), this); m_port = new QLineEdit(QString::number(server.port()), this); - layout->addWidget(label, 1, 0); - layout->addWidget(m_port, 1, 1); + layout->addWidget(label, 2, 0); + layout->addWidget(m_port, 2, 1); label = new QLabel(tr("Nickname :"), this); m_nickname = new QLineEdit(server.nick(), this); - layout->addWidget(label, 2, 0); - layout->addWidget(m_nickname, 2, 1); - label = new QLabel(tr("Description :"), this); - m_description = new QLineEdit(server.description(), this); layout->addWidget(label, 3, 0); - layout->addWidget(m_description, 3, 1); + layout->addWidget(m_nickname, 3, 1); label = new QLabel(tr("Realname :"), this); @@ -26,6 +27,2 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* layout->addWidget(m_realname, 4, 1); - label = new QLabel(tr("Username :"), this); - m_username = new QLineEdit(server.username(), this); - layout->addWidget(label, 3, 0); - layout->addWidget(m_username, 3, 1); label = new QLabel(tr("Password :"), this); @@ -38,4 +35,20 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* +void IRCServerEditor::accept() { + if (m_name->text().length()==0) + QMessageBox::critical(this, tr("Error"), tr("Profile name required")); + else if (m_hostname->text().length()==0) + QMessageBox::critical(this, tr("Error"), tr("Host name required")); + else if (m_port->text().toInt()<=0) + QMessageBox::critical(this, tr("Error"), tr("Port required")); + else if (m_nickname->text().length()==0) + QMessageBox::critical(this, tr("Error"), tr("Nickname required")); + else if (m_realname->text().length()==0) + QMessageBox::critical(this, tr("Error"), tr("Realname required")); + else + QDialog::accept(); +} + IRCServer IRCServerEditor::getServer() { IRCServer server; + server.setName(m_name->text()); server.setHostname(m_hostname->text()); @@ -43,5 +56,4 @@ IRCServer IRCServerEditor::getServer() { server.setNick(m_nickname->text()); - server.setDescription(m_description->text()); server.setRealname(m_realname->text()); - server.setUsername(m_username->text()); + server.setUsername(m_nickname->text()); server.setPassword(m_password->text()); |