summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-03 11:12:33 (UTC)
committer zecke <zecke>2002-11-03 11:12:33 (UTC)
commit5ec23891e1c5b7bc571d86326b511d1a48b14c45 (patch) (unidiff)
tree888f069753c2bffa681dfbb903a316b0d9db9a49
parent2afc9d92749fbd5c2b94475c3eb4607d3b9b0105 (diff)
downloadopie-5ec23891e1c5b7bc571d86326b511d1a48b14c45.zip
opie-5ec23891e1c5b7bc571d86326b511d1a48b14c45.tar.gz
opie-5ec23891e1c5b7bc571d86326b511d1a48b14c45.tar.bz2
Remove default arguments from the implementation
jowenn
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp2
-rw-r--r--noncore/net/opieirc/ircservereditor.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index c8e6190..f94cf1b 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,113 +1,113 @@
1#include <opie/colordialog.h> 1#include <opie/colordialog.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <stdio.h> 3#include <stdio.h>
4#include "ircmisc.h" 4#include "ircmisc.h"
5 5
6IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) { 6IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) {
7 m_color = color; 7 m_color = color;
8 setAlignment(AlignVCenter | AlignCenter); 8 setAlignment(AlignVCenter | AlignCenter);
9 setFrameStyle(QFrame::StyledPanel); 9 setFrameStyle(QFrame::StyledPanel);
10 setFrameShadow(QFrame::Sunken); 10 setFrameShadow(QFrame::Sunken);
11 setBackgroundColor(m_color); 11 setBackgroundColor(m_color);
12} 12}
13 13
14void IRCColorLabel::mousePressEvent(QMouseEvent *) { 14void IRCColorLabel::mousePressEvent(QMouseEvent *) {
15 m_color = OColorDialog::getColor(m_color); 15 m_color = OColorDialog::getColor(m_color);
16 setBackgroundColor(m_color); 16 setBackgroundColor(m_color);
17} 17}
18 18
19QColor IRCColorLabel::color() { 19QColor IRCColorLabel::color() {
20 return m_color; 20 return m_color;
21} 21}
22 22
23IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { 23IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
24 QVBoxLayout *layout = new QVBoxLayout(this, 10, 0); 24 QVBoxLayout *layout = new QVBoxLayout(this, 10, 0);
25 m_label = new IRCColorLabel(color, this); 25 m_label = new IRCColorLabel(color, this);
26 layout->addWidget(m_label); 26 layout->addWidget(m_label);
27} 27}
28 28
29QColor IRCFramedColorLabel::color() { 29QColor IRCFramedColorLabel::color() {
30 return m_label->color(); 30 return m_label->color();
31} 31}
32 32
33 33
34IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { 34IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
35} 35}
36 36
37int IRCTabBar::insertTab(QTab *tab, int index = -1) { 37int IRCTabBar::insertTab(QTab *tab, int index) {
38 /* FIXME: find some nicer way to do this */ 38 /* FIXME: find some nicer way to do this */
39 QExtTab *ext = new QExtTab(); 39 QExtTab *ext = new QExtTab();
40 ext->color = black; 40 ext->color = black;
41 ext->label = tab->text(); 41 ext->label = tab->text();
42 ext->r = tab->rect(); 42 ext->r = tab->rect();
43 ext->enabled = tab->isEnabled(); 43 ext->enabled = tab->isEnabled();
44 ext->iconset = tab->iconSet(); 44 ext->iconset = tab->iconSet();
45 delete tab; 45 delete tab;
46 return QTabBar::insertTab(ext, index); 46 return QTabBar::insertTab(ext, index);
47} 47}
48 48
49void IRCTabBar::setTabColor(int index, QColor color) { 49void IRCTabBar::setTabColor(int index, QColor color) {
50 ((QExtTab *)tab(index))->color = color; 50 ((QExtTab *)tab(index))->color = color;
51 update(); 51 update();
52} 52}
53 53
54void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { 54void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
55 QRect r = br; 55 QRect r = br;
56 QTabBar::paintLabel(p, br, t, focus); 56 QTabBar::paintLabel(p, br, t, focus);
57 if (t->id == currentTab()) 57 if (t->id == currentTab())
58 r.setBottom(r.bottom() - style().defaultFrameWidth()); 58 r.setBottom(r.bottom() - style().defaultFrameWidth());
59 p->setPen(((QExtTab *)t)->color); 59 p->setPen(((QExtTab *)t)->color);
60 p->drawText(r, AlignCenter | ShowPrefix, t->label); 60 p->drawText(r, AlignCenter | ShowPrefix, t->label);
61} 61}
62 62
63IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { 63IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) {
64 setTabBar(new IRCTabBar(this, "tab control")); 64 setTabBar(new IRCTabBar(this, "tab control"));
65} 65}
66 66
67void IRCTabWidget::setTabColor(int index, QColor color) { 67void IRCTabWidget::setTabColor(int index, QColor color) {
68 ((IRCTabBar *)tabBar())->setTabColor(index, color); 68 ((IRCTabBar *)tabBar())->setTabColor(index, color);
69} 69}
70 70
71 71
72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { 72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
73 m_index = -1; 73 m_index = -1;
74 installEventFilter(this); 74 installEventFilter(this);
75} 75}
76 76
77void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { 77void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
78 int key = event->key(); 78 int key = event->key();
79 if (key == Key_Up) { 79 if (key == Key_Up) {
80 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { 80 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
81 m_index++; 81 m_index++;
82 setText(m_history[m_index]); 82 setText(m_history[m_index]);
83 } 83 }
84 } else if (key == Key_Down) { 84 } else if (key == Key_Down) {
85 if (m_history.count() > 0 && m_index > 0) { 85 if (m_history.count() > 0 && m_index > 0) {
86 m_index--; 86 m_index--;
87 setText(m_history[m_index]); 87 setText(m_history[m_index]);
88 } 88 }
89 if (m_index == 0) { 89 if (m_index == 0) {
90 m_index = -1; 90 m_index = -1;
91 setText(""); 91 setText("");
92 } 92 }
93 } else if (key == Key_Return) { 93 } else if (key == Key_Return) {
94 m_history.prepend(text()); 94 m_history.prepend(text());
95 m_index = -1; 95 m_index = -1;
96 } else if (key == Key_Tab) { 96 } else if (key == Key_Tab) {
97 printf("got tab\n"); 97 printf("got tab\n");
98 return; 98 return;
99 } 99 }
100 QLineEdit::keyPressEvent(event); 100 QLineEdit::keyPressEvent(event);
101} 101}
102 102
103bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { 103bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
104 if (event->type() == QEvent::KeyPress) { 104 if (event->type() == QEvent::KeyPress) {
105 QKeyEvent *k = (QKeyEvent *) event; 105 QKeyEvent *k = (QKeyEvent *) event;
106 /* Catch tab characters */ 106 /* Catch tab characters */
107 if (k->key() == Key_Tab) { 107 if (k->key() == Key_Tab) {
108 qDebug("tab!"); 108 qDebug("tab!");
109 return TRUE; 109 return TRUE;
110 } 110 }
111 } 111 }
112 return QLineEdit::eventFilter(object, event); 112 return QLineEdit::eventFilter(object, event);
113} 113}
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
7IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { 7IRCServerEditor::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
49void IRCServerEditor::accept() { 49void 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
74IRCServer IRCServerEditor::getServer() { 74IRCServer 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}