author | wazlaf <wazlaf> | 2002-09-11 22:22:04 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-11 22:22:04 (UTC) |
commit | 4864665ad76095620fdf5aa19d24f05967f32b40 (patch) (unidiff) | |
tree | 4b3e371b5da03292ce09f7e388885dd3ec049ff8 /noncore/net/opieirc/ircservereditor.cpp | |
parent | 7ab82ad13aaf708ffba4bf4294d29b789007ddde (diff) | |
download | opie-4864665ad76095620fdf5aa19d24f05967f32b40.zip opie-4864665ad76095620fdf5aa19d24f05967f32b40.tar.gz opie-4864665ad76095620fdf5aa19d24f05967f32b40.tar.bz2 |
serverlist browser
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,2 +1,3 @@ | |||
1 | #include <qmessagebox.h> | ||
1 | #include <qlayout.h> | 2 | #include <qlayout.h> |
2 | #include <qlabel.h> | 3 | #include <qlabel.h> |
@@ -5,28 +6,24 @@ | |||
5 | 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) { |
6 | QGridLayout *layout = new QGridLayout(this, 6, 2, 5, 5); | 7 | QGridLayout *layout = new QGridLayout(this, 6, 2, 5, 5); |
7 | QLabel *label = new QLabel(tr("Hostname :"), this); | 8 | QLabel *label = new QLabel(tr("Profile name :"), this); |
8 | m_hostname = new QLineEdit(server.hostname(), this); | 9 | m_name = new QLineEdit(server.name(), this); |
9 | layout->addWidget(label, 0, 0); | 10 | layout->addWidget(label, 0, 0); |
10 | layout->addWidget(m_hostname, 0, 1); | 11 | layout->addWidget(m_name, 0, 1); |
12 | label = new QLabel(tr("Hostname :"), this); | ||
13 | m_hostname = new QLineEdit(server.hostname(), this); | ||
14 | layout->addWidget(label, 1, 0); | ||
15 | layout->addWidget(m_hostname, 1, 1); | ||
11 | label = new QLabel(tr("Port :"), this); | 16 | label = new QLabel(tr("Port :"), this); |
12 | m_port = new QLineEdit(QString::number(server.port()), this); | 17 | m_port = new QLineEdit(QString::number(server.port()), this); |
13 | layout->addWidget(label, 1, 0); | 18 | layout->addWidget(label, 2, 0); |
14 | layout->addWidget(m_port, 1, 1); | 19 | layout->addWidget(m_port, 2, 1); |
15 | label = new QLabel(tr("Nickname :"), this); | 20 | label = new QLabel(tr("Nickname :"), this); |
16 | m_nickname = new QLineEdit(server.nick(), this); | 21 | m_nickname = new QLineEdit(server.nick(), this); |
17 | layout->addWidget(label, 2, 0); | ||
18 | layout->addWidget(m_nickname, 2, 1); | ||
19 | label = new QLabel(tr("Description :"), this); | ||
20 | m_description = new QLineEdit(server.description(), this); | ||
21 | layout->addWidget(label, 3, 0); | 22 | layout->addWidget(label, 3, 0); |
22 | layout->addWidget(m_description, 3, 1); | 23 | layout->addWidget(m_nickname, 3, 1); |
23 | label = new QLabel(tr("Realname :"), this); | 24 | label = new QLabel(tr("Realname :"), this); |
24 | m_realname = new QLineEdit(server.realname(), this); | 25 | m_realname = new QLineEdit(server.realname(), this); |
25 | layout->addWidget(label, 4, 0); | 26 | layout->addWidget(label, 4, 0); |
26 | layout->addWidget(m_realname, 4, 1); | 27 | layout->addWidget(m_realname, 4, 1); |
27 | label = new QLabel(tr("Username :"), this); | ||
28 | m_username = new QLineEdit(server.username(), this); | ||
29 | layout->addWidget(label, 3, 0); | ||
30 | layout->addWidget(m_username, 3, 1); | ||
31 | label = new QLabel(tr("Password :"), this); | 28 | label = new QLabel(tr("Password :"), this); |
32 | m_password = new QLineEdit(server.password(), this); | 29 | m_password = new QLineEdit(server.password(), this); |
@@ -37,12 +34,27 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* | |||
37 | 34 | ||
38 | 35 | ||
36 | void IRCServerEditor::accept() { | ||
37 | if (m_name->text().length()==0) | ||
38 | QMessageBox::critical(this, tr("Error"), tr("Profile name required")); | ||
39 | else if (m_hostname->text().length()==0) | ||
40 | QMessageBox::critical(this, tr("Error"), tr("Host name required")); | ||
41 | else if (m_port->text().toInt()<=0) | ||
42 | QMessageBox::critical(this, tr("Error"), tr("Port required")); | ||
43 | else if (m_nickname->text().length()==0) | ||
44 | QMessageBox::critical(this, tr("Error"), tr("Nickname required")); | ||
45 | else if (m_realname->text().length()==0) | ||
46 | QMessageBox::critical(this, tr("Error"), tr("Realname required")); | ||
47 | else | ||
48 | QDialog::accept(); | ||
49 | } | ||
50 | |||
39 | IRCServer IRCServerEditor::getServer() { | 51 | IRCServer IRCServerEditor::getServer() { |
40 | IRCServer server; | 52 | IRCServer server; |
53 | server.setName(m_name->text()); | ||
41 | server.setHostname(m_hostname->text()); | 54 | server.setHostname(m_hostname->text()); |
42 | server.setPort(m_port->text().toInt()); | 55 | server.setPort(m_port->text().toInt()); |
43 | server.setNick(m_nickname->text()); | 56 | server.setNick(m_nickname->text()); |
44 | server.setDescription(m_description->text()); | ||
45 | server.setRealname(m_realname->text()); | 57 | server.setRealname(m_realname->text()); |
46 | server.setUsername(m_username->text()); | 58 | server.setUsername(m_nickname->text()); |
47 | server.setPassword(m_password->text()); | 59 | server.setPassword(m_password->text()); |
48 | return server; | 60 | return server; |