summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircserverlist.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircserverlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircserverlist.cpp76
1 files changed, 51 insertions, 25 deletions
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 +1,9 @@
1
2#include "ircserverlist.h"
3#include "ircservereditor.h"
4
5/* OPIE */
6#include <qpe/qpeapplication.h>
7
8/* QT */
1#include <qlayout.h> 9#include <qlayout.h>
@@ -5,8 +13,8 @@
5#include <qwhatsthis.h> 13#include <qwhatsthis.h>
6#include "ircserverlist.h"
7#include "ircservereditor.h"
8 14
9class IRCListBoxServer : public QListBoxText { 15class IRCListBoxServer : public QListBoxText
16{
10public: 17public:
11 IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) { 18 IRCListBoxServer(IRCServer server) : QListBoxText(server.name())
19 {
12 m_server = server; 20 m_server = server;
@@ -14,7 +22,9 @@ public:
14 22
15 IRCServer server() { 23 IRCServer server()
24 {
16 return m_server; 25 return m_server;
17 } 26 }
18 27
19 void setServer(IRCServer server) { 28 void setServer(IRCServer server)
29 {
20 m_server = server; 30 m_server = server;
@@ -26,3 +36,4 @@ protected:
26 36
27IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { 37IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp)
38{
28 QVBoxLayout *layout = new QVBoxLayout(this, 5, 5); 39 QVBoxLayout *layout = new QVBoxLayout(this, 5, 5);
@@ -50,7 +61,10 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla
50 int count = m_config->readNumEntry("ServerCount", 0); 61 int count = m_config->readNumEntry("ServerCount", 0);
51 if (count) { 62 if (count)
52 for (int i=0; i<count; i++) { 63 {
64 for (int i=0; i<count; i++)
65 {
53 m_config->setGroup("OpieIRC"); 66 m_config->setGroup("OpieIRC");
54 QString name = m_config->readEntry("Server"+QString::number(i)); 67 QString name = m_config->readEntry("Server"+QString::number(i));
55 if (name.length() > 0) { 68 if (name.length() > 0)
69 {
56 IRCServer server; 70 IRCServer server;
@@ -69,10 +83,12 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla
69 } 83 }
70 84
71 showMaximized(); 85 QPEApplication::showDialog( this );
72} 86}
73 87
74void IRCServerList::addServer() { 88void IRCServerList::addServer()
89{
75 IRCServer server; 90 IRCServer server;
76 IRCServerEditor editor(server, this, "ServerEditor", TRUE); 91 IRCServerEditor editor(server, this, "ServerEditor", TRUE);
77 if (editor.exec() == QDialog::Accepted) { 92 if (editor.exec() == QDialog::Accepted)
93 {
78 server = editor.getServer(); 94 server = editor.getServer();
@@ -83,5 +99,7 @@ void IRCServerList::addServer() {
83 99
84void IRCServerList::delServer() { 100void IRCServerList::delServer()
101{
85 int index = m_list->currentItem(); 102 int index = m_list->currentItem();
86 if (index != -1) { 103 if (index != -1)
104 {
87 m_list->removeItem(index); 105 m_list->removeItem(index);
@@ -90,5 +108,7 @@ void IRCServerList::delServer() {
90 108
91void IRCServerList::editServer() { 109void IRCServerList::editServer()
110{
92 int index = m_list->currentItem(); 111 int index = m_list->currentItem();
93 if (index != -1) { 112 if (index != -1)
113 {
94 IRCListBoxServer *item = (IRCListBoxServer *)m_list->item(index); 114 IRCListBoxServer *item = (IRCListBoxServer *)m_list->item(index);
@@ -96,3 +116,4 @@ void IRCServerList::editServer() {
96 IRCServerEditor editor(server, this, "ServerEditor", TRUE); 116 IRCServerEditor editor(server, this, "ServerEditor", TRUE);
97 if (editor.exec() == QDialog::Accepted) { 117 if (editor.exec() == QDialog::Accepted)
118 {
98 server = editor.getServer(); 119 server = editor.getServer();
@@ -103,3 +124,4 @@ void IRCServerList::editServer() {
103 124
104int IRCServerList::exec() { 125int IRCServerList::exec()
126{
105 int returncode = QDialog::exec(); 127 int returncode = QDialog::exec();
@@ -108,3 +130,4 @@ int IRCServerList::exec() {
108 m_config->writeEntry("ServerCount", QString::number(m_list->count())); 130 m_config->writeEntry("ServerCount", QString::number(m_list->count()));
109 for (unsigned int i=0; i<m_list->count(); i++) { 131 for (unsigned int i=0; i<m_list->count(); i++)
132 {
110 IRCServer server = ((IRCListBoxServer *)m_list->item(i))->server(); 133 IRCServer server = ((IRCListBoxServer *)m_list->item(i))->server();
@@ -124,3 +147,4 @@ int IRCServerList::exec() {
124 147
125bool IRCServerList::hasServer() { 148bool IRCServerList::hasServer()
149{
126 return (m_list->currentItem() != -1); 150 return (m_list->currentItem() != -1);
@@ -128,3 +152,4 @@ bool IRCServerList::hasServer() {
128 152
129IRCServer IRCServerList::server() { 153IRCServer IRCServerList::server()
154{
130 return ((IRCListBoxServer *)m_list->item(m_list->currentItem()))->server(); 155 return ((IRCListBoxServer *)m_list->item(m_list->currentItem()))->server();
@@ -132,3 +157,4 @@ IRCServer IRCServerList::server() {
132 157
133IRCServerList::~IRCServerList() { 158IRCServerList::~IRCServerList()
159{
134 delete m_config; 160 delete m_config;