summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircserverlist.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircserverlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircserverlist.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircserverlist.cpp b/noncore/net/opieirc/ircserverlist.cpp
index 62bfc17..3e78469 100644
--- a/noncore/net/opieirc/ircserverlist.cpp
+++ b/noncore/net/opieirc/ircserverlist.cpp
@@ -61,88 +61,97 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla
int count = m_config->readNumEntry("ServerCount", 0);
if (count)
{
for (int i=0; i<count; i++)
{
m_config->setGroup("OpieIRC");
QString name = m_config->readEntry("Server"+QString::number(i));
if (name.length() > 0)
{
IRCServer server;
m_config->setGroup(name);
server.setName(name);
server.setHostname(m_config->readEntry("Hostname"));
server.setPort(m_config->readNumEntry("Port"));
server.setUsername(m_config->readEntry("Username"));
server.setPassword(m_config->readEntry("Password"));
server.setNick(m_config->readEntry("Nick"));
server.setRealname(m_config->readEntry("Realname"));
server.setChannels(m_config->readEntry("Channels"));
m_list->insertItem(new IRCListBoxServer(server));
}
}
}
+ connect(m_list, SIGNAL(doubleClicked(QListBoxItem*)),
+ this, SLOT(acceptOnClick(QListBoxItem *)));
+ connect(m_list, SIGNAL(returnPressed(QListBoxItem*)),
+ this, SLOT(acceptOnClick(QListBoxItem*)));
+
QPEApplication::showDialog( this );
}
void IRCServerList::addServer()
{
IRCServer server;
IRCServerEditor editor(server, this, "ServerEditor", TRUE);
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()
{
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);
}
}
}
+void IRCServerList::acceptOnClick( QListBoxItem* ) {
+ accept();
+}
+
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; 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()