summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircserverlist.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircserverlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircserverlist.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/noncore/net/opieirc/ircserverlist.cpp b/noncore/net/opieirc/ircserverlist.cpp
index e664ba1..3293591 100644
--- a/noncore/net/opieirc/ircserverlist.cpp
+++ b/noncore/net/opieirc/ircserverlist.cpp
@@ -1,32 +1,30 @@
-#include <stdio.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qpushbutton.h>
#include "ircserverlist.h"
#include "ircservereditor.h"
-#include <stdio.h>
class IRCListBoxServer : public QListBoxText {
public:
IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) {
m_server = server;
}
IRCServer server() {
return m_server;
}
void setServer(IRCServer server) {
m_server = server;
setText(m_server.name());
}
protected:
IRCServer m_server;
};
IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags f) : QDialog(parent, name, modal, f) {
QVBoxLayout *layout = new QVBoxLayout(this, 5, 5);
setCaption(tr("Serverlist Browser"));
QLabel *label = new QLabel(tr("Please choose a server profile"), this);
label->setAlignment(AlignHCenter);
@@ -81,49 +79,48 @@ void IRCServerList::addServer() {
void IRCServerList::delServer() {
int index = m_list->currentItem();
if (index != -1) {
m_list->removeItem(index);
}
}
void IRCServerList::editServer() {
int index = m_list->currentItem();
if (index != -1) {
IRCListBoxServer *item = (IRCListBoxServer *)m_list->item(index);
IRCServer server = item->server();
IRCServerEditor editor(server, this, "ServerEditor", TRUE);
if (editor.exec() == QDialog::Accepted) {
server = editor.getServer();
item->setServer(server);
}
}
}
int IRCServerList::exec() {
int returncode = QDialog::exec();
/* Now save the changes */
m_config->setGroup("OpieIRC");
- m_config->clearGroup();
m_config->writeEntry("ServerCount", QString::number(m_list->count()));
for (unsigned int i=0; i<m_list->count(); i++) {
IRCServer server = ((IRCListBoxServer *)m_list->item(i))->server();
m_config->setGroup("OpieIRC");
m_config->writeEntry("Server"+QString::number(i), server.name());
m_config->setGroup(server.name());
m_config->writeEntry("Hostname", server.hostname());
m_config->writeEntry("Port", QString::number(server.port()));
m_config->writeEntry("Username", server.username());
m_config->writeEntry("Password", server.password());
m_config->writeEntry("Nick", server.nick());
m_config->writeEntry("Realname", server.realname());
m_config->writeEntry("Channels", server.channels());
}
return returncode;
}
bool IRCServerList::hasServer() {
return (m_list->currentItem() != -1);
}
IRCServer IRCServerList::server() {
return ((IRCListBoxServer *)m_list->item(m_list->currentItem()))->server();
}