Diffstat (limited to 'noncore/net/opieirc/ircservereditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircservereditor.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp index 8604835..91384fd 100644 --- a/noncore/net/opieirc/ircservereditor.cpp +++ b/noncore/net/opieirc/ircservereditor.cpp | |||
@@ -1,85 +1,85 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qwhatsthis.h> | 4 | #include <qwhatsthis.h> |
5 | #include "ircservereditor.h" | 5 | #include "ircservereditor.h" |
6 | 6 | ||
7 | IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { | 7 | IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { |
8 | QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5); | 8 | QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5); |
9 | QLabel *label = new QLabel(tr("Profile name :"), this); | 9 | QLabel *label = new QLabel(tr("Profile name :"), this); |
10 | m_name = new QLineEdit(server.name(), this); | 10 | m_name = new QLineEdit(server.name(), this); |
11 | QWhatsThis::add(m_name, tr("The name of this server profile in the overview")); | 11 | QWhatsThis::add(m_name, tr("The name of this server profile in the overview")); |
12 | layout->addWidget(label, 0, 0); | 12 | layout->addWidget(label, 0, 0); |
13 | layout->addWidget(m_name, 0, 1); | 13 | layout->addWidget(m_name, 0, 1); |
14 | label = new QLabel(tr("Hostname :"), this); | 14 | label = new QLabel(tr("Hostname :"), this); |
15 | m_hostname = new QLineEdit(server.hostname(), this); | 15 | m_hostname = new QLineEdit(server.hostname(), this); |
16 | QWhatsThis::add(m_hostname, tr("The server to connect to - can be any valid host name or IP address")); | 16 | QWhatsThis::add(m_hostname, tr("The server to connect to - can be any valid host name or IP address")); |
17 | layout->addWidget(label, 1, 0); | 17 | layout->addWidget(label, 1, 0); |
18 | layout->addWidget(m_hostname, 1, 1); | 18 | layout->addWidget(m_hostname, 1, 1); |
19 | label = new QLabel(tr("Port :"), this); | 19 | label = new QLabel(tr("Port :"), this); |
20 | m_port = new QLineEdit(QString::number(server.port()), this); | 20 | m_port = new QLineEdit(QString::number(server.port()), this); |
21 | QWhatsThis::add(m_port, tr("The server port to connect to. Usually 6667")); | 21 | QWhatsThis::add(m_port, tr("The server port to connect to. Usually 6667")); |
22 | layout->addWidget(label, 2, 0); | 22 | layout->addWidget(label, 2, 0); |
23 | layout->addWidget(m_port, 2, 1); | 23 | layout->addWidget(m_port, 2, 1); |
24 | label = new QLabel(tr("Nickname :"), this); | 24 | label = new QLabel(tr("Nickname :"), this); |
25 | m_nickname = new QLineEdit(server.nick(), this); | 25 | m_nickname = new QLineEdit(server.nick(), this); |
26 | QWhatsThis::add(m_nickname, tr("Your nick name on the IRC network")); | 26 | QWhatsThis::add(m_nickname, tr("Your nick name on the IRC network")); |
27 | layout->addWidget(label, 3, 0); | 27 | layout->addWidget(label, 3, 0); |
28 | layout->addWidget(m_nickname, 3, 1); | 28 | layout->addWidget(m_nickname, 3, 1); |
29 | label = new QLabel(tr("Realname :"), this); | 29 | label = new QLabel(tr("Realname :"), this); |
30 | m_realname = new QLineEdit(server.realname(), this); | 30 | m_realname = new QLineEdit(server.realname(), this); |
31 | QWhatsThis::add(m_realname, tr("Your real name")); | 31 | QWhatsThis::add(m_realname, tr("Your real name")); |
32 | layout->addWidget(label, 4, 0); | 32 | layout->addWidget(label, 4, 0); |
33 | layout->addWidget(m_realname, 4, 1); | 33 | layout->addWidget(m_realname, 4, 1); |
34 | label = new QLabel(tr("Password :"), this); | 34 | label = new QLabel(tr("Password :"), this); |
35 | m_password = new QLineEdit(server.password(), this); | 35 | m_password = new QLineEdit(server.password(), this); |
36 | QWhatsThis::add(m_password, tr("Password to connect to the server (if required)")); | 36 | QWhatsThis::add(m_password, tr("Password to connect to the server (if required)")); |
37 | layout->addWidget(label, 5, 0); | 37 | layout->addWidget(label, 5, 0); |
38 | layout->addWidget(m_password, 5, 1); | 38 | layout->addWidget(m_password, 5, 1); |
39 | label = new QLabel(tr("Channels :"), this); | 39 | label = new QLabel(tr("Channels :"), this); |
40 | m_channels = new QLineEdit(server.channels(), this); | 40 | m_channels = new QLineEdit(server.channels(), this); |
41 | QWhatsThis::add(m_channels, tr("Comma-Separated list of all channels you would like to join automatically")); | 41 | QWhatsThis::add(m_channels, tr("Comma-Separated list of all channels you would like to join automatically")); |
42 | layout->addWidget(label, 6, 0); | 42 | layout->addWidget(label, 6, 0); |
43 | layout->addWidget(m_channels, 6, 1); | 43 | layout->addWidget(m_channels, 6, 1); |
44 | setCaption(tr("Edit server information")); | 44 | setCaption(tr("Edit server information")); |
45 | showMaximized(); | 45 | showMaximized(); |
46 | } | 46 | } |
47 | 47 | ||
48 | 48 | ||
49 | void IRCServerEditor::accept() { | 49 | void IRCServerEditor::accept() { |
50 | if (m_name->text().length()==0) | 50 | if (m_name->text().length()==0) |
51 | QMessageBox::critical(this, tr("Error"), tr("Profile name required")); | 51 | QMessageBox::critical(this, tr("Error"), tr("Profile name required")); |
52 | else if (m_hostname->text().length()==0) | 52 | else if (m_hostname->text().length()==0) |
53 | QMessageBox::critical(this, tr("Error"), tr("Host name required")); | 53 | QMessageBox::critical(this, tr("Error"), tr("Host name required")); |
54 | else if (m_port->text().toInt()<=0) | 54 | else if (m_port->text().toInt()<=0) |
55 | QMessageBox::critical(this, tr("Error"), tr("Port required")); | 55 | QMessageBox::critical(this, tr("Error"), tr("Port required")); |
56 | else if (m_nickname->text().length()==0) | 56 | else if (m_nickname->text().length()==0) |
57 | QMessageBox::critical(this, tr("Error"), tr("Nickname required")); | 57 | QMessageBox::critical(this, tr("Error"), tr("Nickname required")); |
58 | else if (m_realname->text().length()==0) | 58 | else if (m_realname->text().length()==0) |
59 | QMessageBox::critical(this, tr("Error"), tr("Realname required")); | 59 | QMessageBox::critical(this, tr("Error"), tr("Realname required")); |
60 | else { | 60 | else { |
61 | /* Now verify whether the channel list has a valid format */ | 61 | /* Now verify whether the channel list has a valid format */ |
62 | QStringList channels = QStringList::split(QChar(','), m_channels->text()); | 62 | QStringList channels = QStringList::split(QChar(','), m_channels->text()); |
63 | for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { | 63 | for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { |
64 | QString channelName = (*it).stripWhiteSpace(); | 64 | QString channelName = (*it).stripWhiteSpace(); |
65 | if (!channelName.startsWith("#") && !channelName.startsWith("+")) { | 65 | if (!channelName.startsWith("#") && !channelName.startsWith("+")) { |
66 | QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with either '#' or '+'")); | 66 | QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with either '#' or '+'")); |
67 | return; | 67 | return; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | QDialog::accept(); | 70 | QDialog::accept(); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | IRCServer IRCServerEditor::getServer() { | 74 | IRCServer IRCServerEditor::getServer() { |
75 | IRCServer server; | 75 | IRCServer server; |
76 | server.setName(m_name->text()); | 76 | server.setName(m_name->text()); |
77 | server.setHostname(m_hostname->text()); | 77 | server.setHostname(m_hostname->text()); |
78 | server.setPort(m_port->text().toInt()); | 78 | server.setPort(m_port->text().toInt()); |
79 | server.setNick(m_nickname->text()); | 79 | server.setNick(m_nickname->text()); |
80 | server.setRealname(m_realname->text()); | 80 | server.setRealname(m_realname->text()); |
81 | server.setUsername(m_nickname->text()); | 81 | server.setUsername(m_nickname->text()); |
82 | server.setPassword(m_password->text()); | 82 | server.setPassword(m_password->text()); |
83 | server.setChannels(m_channels->text()); | 83 | server.setChannels(m_channels->text()); |
84 | return server; | 84 | return server; |
85 | } | 85 | } |