From 460258f203be746ff79e14f32a823f381b8ea513 Mon Sep 17 00:00:00 2001 From: ar Date: Sat, 21 Feb 2004 15:27:41 +0000 Subject: improve support for BigScreen --- (limited to 'noncore/net/opieirc/ircserverlist.cpp') diff --git a/noncore/net/opieirc/ircserverlist.cpp b/noncore/net/opieirc/ircserverlist.cpp index 595ae3e..62bfc17 100644 --- a/noncore/net/opieirc/ircserverlist.cpp +++ b/noncore/net/opieirc/ircserverlist.cpp @@ -1,22 +1,32 @@ + +#include "ircserverlist.h" +#include "ircservereditor.h" + +/* OPIE */ +#include + +/* QT */ #include #include #include #include #include -#include "ircserverlist.h" -#include "ircservereditor.h" -class IRCListBoxServer : public QListBoxText { +class IRCListBoxServer : public QListBoxText +{ public: - IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) { + IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) + { m_server = server; } - IRCServer server() { + IRCServer server() + { return m_server; } - - void setServer(IRCServer server) { + + void setServer(IRCServer server) + { m_server = server; setText(m_server.name()); } @@ -24,7 +34,8 @@ protected: IRCServer m_server; }; -IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { +IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) +{ QVBoxLayout *layout = new QVBoxLayout(this, 5, 5); setCaption(tr("Serverlist Browser")); QLabel *label = new QLabel(tr("Please choose a server profile"), this); @@ -48,11 +59,14 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla m_config = new Config("OpieIRC"); m_config->setGroup("OpieIRC"); int count = m_config->readNumEntry("ServerCount", 0); - if (count) { - for (int i=0; isetGroup("OpieIRC"); QString name = m_config->readEntry("Server"+QString::number(i)); - if (name.length() > 0) { + if (name.length() > 0) + { IRCServer server; m_config->setGroup(name); server.setName(name); @@ -67,46 +81,55 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla } } } - - showMaximized(); + + QPEApplication::showDialog( this ); } -void IRCServerList::addServer() { +void IRCServerList::addServer() +{ IRCServer server; IRCServerEditor editor(server, this, "ServerEditor", TRUE); - if (editor.exec() == QDialog::Accepted) { + if (editor.exec() == QDialog::Accepted) + { server = editor.getServer(); /* Gets deleted by QListBox, so this is ok */ m_list->insertItem(new IRCListBoxServer(server)); } } -void IRCServerList::delServer() { +void IRCServerList::delServer() +{ int index = m_list->currentItem(); - if (index != -1) { + if (index != -1) + { m_list->removeItem(index); } } -void IRCServerList::editServer() { +void IRCServerList::editServer() +{ int index = m_list->currentItem(); - if (index != -1) { + 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) { + if (editor.exec() == QDialog::Accepted) + { server = editor.getServer(); item->setServer(server); } } } -int IRCServerList::exec() { +int IRCServerList::exec() +{ int returncode = QDialog::exec(); /* Now save the changes */ m_config->setGroup("OpieIRC"); m_config->writeEntry("ServerCount", QString::number(m_list->count())); - for (unsigned int i=0; icount(); i++) { + for (unsigned int i=0; icount(); i++) + { IRCServer server = ((IRCListBoxServer *)m_list->item(i))->server(); m_config->setGroup("OpieIRC"); m_config->writeEntry("Server"+QString::number(i), server.name()); @@ -122,14 +145,17 @@ int IRCServerList::exec() { return returncode; } -bool IRCServerList::hasServer() { +bool IRCServerList::hasServer() +{ return (m_list->currentItem() != -1); } -IRCServer IRCServerList::server() { +IRCServer IRCServerList::server() +{ return ((IRCListBoxServer *)m_list->item(m_list->currentItem()))->server(); } -IRCServerList::~IRCServerList() { +IRCServerList::~IRCServerList() +{ delete m_config; } -- cgit v0.9.0.2