author | harlekin <harlekin> | 2003-12-08 23:25:46 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-08 23:25:46 (UTC) |
commit | e372949ac776a7d986cac91b2ff1a5022040d43b (patch) (unidiff) | |
tree | 4c37d554d55501e1be587828651d90722a18f681 | |
parent | 92d67d6f0e34cdee111c94d2b0304768dfdea2f9 (diff) | |
download | opie-e372949ac776a7d986cac91b2ff1a5022040d43b.zip opie-e372949ac776a7d986cac91b2ff1a5022040d43b.tar.gz opie-e372949ac776a7d986cac91b2ff1a5022040d43b.tar.bz2 |
remove not used includes
-rw-r--r-- | noncore/net/opieirc/ircchannellist.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 3 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/main.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 2 |
8 files changed, 0 insertions, 12 deletions
diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp index 566b223..4e13dee 100644 --- a/noncore/net/opieirc/ircchannellist.cpp +++ b/noncore/net/opieirc/ircchannellist.cpp | |||
@@ -1,48 +1,47 @@ | |||
1 | #include <qpe/resource.h> | 1 | #include <qpe/resource.h> |
2 | #include <qpixmap.h> | ||
3 | #include "ircchannellist.h" | 2 | #include "ircchannellist.h" |
4 | 3 | ||
5 | IRCChannelList::IRCChannelList(IRCChannel *channel, QWidget *parent, const char *name, WFlags f) : QListBox(parent, name, f) { | 4 | IRCChannelList::IRCChannelList(IRCChannel *channel, QWidget *parent, const char *name, WFlags f) : QListBox(parent, name, f) { |
6 | m_channel = channel; | 5 | m_channel = channel; |
7 | } | 6 | } |
8 | 7 | ||
9 | void IRCChannelList::update() { | 8 | void IRCChannelList::update() { |
10 | QPixmap op = Resource::loadPixmap("opieirc/op"); | 9 | QPixmap op = Resource::loadPixmap("opieirc/op"); |
11 | QPixmap hop = Resource::loadPixmap("opieirc/hop"); | 10 | QPixmap hop = Resource::loadPixmap("opieirc/hop"); |
12 | QPixmap voice = Resource::loadPixmap("opieirc/voice"); | 11 | QPixmap voice = Resource::loadPixmap("opieirc/voice"); |
13 | QListIterator<IRCChannelPerson> it = m_channel->people(); | 12 | QListIterator<IRCChannelPerson> it = m_channel->people(); |
14 | clear(); | 13 | clear(); |
15 | for (; it.current(); ++it) { | 14 | for (; it.current(); ++it) { |
16 | IRCChannelPerson *person = it.current(); | 15 | IRCChannelPerson *person = it.current(); |
17 | if (person->flags & PERSON_FLAG_OP) { | 16 | if (person->flags & PERSON_FLAG_OP) { |
18 | insertItem(op, person->person->nick()); | 17 | insertItem(op, person->person->nick()); |
19 | } else if (person->flags & PERSON_FLAG_HALFOP) { | 18 | } else if (person->flags & PERSON_FLAG_HALFOP) { |
20 | insertItem(op, person->person->nick()); | 19 | insertItem(op, person->person->nick()); |
21 | } else if (person->flags & PERSON_FLAG_VOICE) { | 20 | } else if (person->flags & PERSON_FLAG_VOICE) { |
22 | insertItem(voice, person->person->nick()); | 21 | insertItem(voice, person->person->nick()); |
23 | } else { | 22 | } else { |
24 | insertItem(person->person->nick()); | 23 | insertItem(person->person->nick()); |
25 | } | 24 | } |
26 | } | 25 | } |
27 | sort(); | 26 | sort(); |
28 | } | 27 | } |
29 | 28 | ||
30 | 29 | ||
31 | bool IRCChannelList::hasPerson(QString nick) { | 30 | bool IRCChannelList::hasPerson(QString nick) { |
32 | for (unsigned int i=0; i<count(); i++) { | 31 | for (unsigned int i=0; i<count(); i++) { |
33 | if (text(i) == nick) | 32 | if (text(i) == nick) |
34 | return TRUE; | 33 | return TRUE; |
35 | } | 34 | } |
36 | return FALSE; | 35 | return FALSE; |
37 | } | 36 | } |
38 | 37 | ||
39 | bool IRCChannelList::removePerson(QString nick) { | 38 | bool IRCChannelList::removePerson(QString nick) { |
40 | for (unsigned int i=0; i<count(); i++) { | 39 | for (unsigned int i=0; i<count(); i++) { |
41 | if (text(i) == nick){ | 40 | if (text(i) == nick){ |
42 | removeItem(i); | 41 | removeItem(i); |
43 | return TRUE; | 42 | return TRUE; |
44 | } | 43 | } |
45 | } | 44 | } |
46 | return FALSE; | 45 | return FALSE; |
47 | } | 46 | } |
48 | 47 | ||
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index 2b8b65e..b0771f6 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -1,131 +1,129 @@ | |||
1 | #include <qpe/qpeapplication.h> | ||
2 | #include <qpe/resource.h> | 1 | #include <qpe/resource.h> |
3 | #include <qcursor.h> | ||
4 | #include <qwhatsthis.h> | 2 | #include <qwhatsthis.h> |
5 | #include <qhbox.h> | 3 | #include <qhbox.h> |
6 | #include "ircchanneltab.h" | 4 | #include "ircchanneltab.h" |
7 | #include "ircservertab.h" | 5 | #include "ircservertab.h" |
8 | 6 | ||
9 | IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 7 | IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
10 | m_mainWindow = mainWindow; | 8 | m_mainWindow = mainWindow; |
11 | m_parentTab = parentTab; | 9 | m_parentTab = parentTab; |
12 | m_channel = channel; | 10 | m_channel = channel; |
13 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); | 11 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); |
14 | QHBox *hbox = new QHBox(this); | 12 | QHBox *hbox = new QHBox(this); |
15 | m_textview = new QTextView(hbox); | 13 | m_textview = new QTextView(hbox); |
16 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 14 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
17 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 15 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
18 | m_listVisible = TRUE; | 16 | m_listVisible = TRUE; |
19 | m_listButton = new QPushButton(">", m_textview); | 17 | m_listButton = new QPushButton(">", m_textview); |
20 | m_textview->setCornerWidget(m_listButton); | 18 | m_textview->setCornerWidget(m_listButton); |
21 | m_textview->setTextFormat(RichText); | 19 | m_textview->setTextFormat(RichText); |
22 | QWhatsThis::add(m_textview, tr("Channel discussion")); | 20 | QWhatsThis::add(m_textview, tr("Channel discussion")); |
23 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); | 21 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); |
24 | m_list = new IRCChannelList(m_channel, hbox); | 22 | m_list = new IRCChannelList(m_channel, hbox); |
25 | m_list->update(); | 23 | m_list->update(); |
26 | m_list->setMaximumWidth(LISTWIDTH); | 24 | m_list->setMaximumWidth(LISTWIDTH); |
27 | m_field = new IRCHistoryLineEdit(this); | 25 | m_field = new IRCHistoryLineEdit(this); |
28 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); | 26 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); |
29 | m_popup = new QPopupMenu(m_list); | 27 | m_popup = new QPopupMenu(m_list); |
30 | m_lines = 0; | 28 | m_lines = 0; |
31 | /* Required so that embedded-style "right" clicks work */ | 29 | /* Required so that embedded-style "right" clicks work */ |
32 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); | 30 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); |
33 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); | 31 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); |
34 | /* Construct the popup menu */ | 32 | /* Construct the popup menu */ |
35 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | 33 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); |
36 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); | 34 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); |
37 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); | 35 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); |
38 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); | 36 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); |
39 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); | 37 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); |
40 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); | 38 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); |
41 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); | 39 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); |
42 | m_layout->add(hbox); | 40 | m_layout->add(hbox); |
43 | hbox->show(); | 41 | hbox->show(); |
44 | m_layout->add(m_field); | 42 | m_layout->add(m_field); |
45 | m_field->setFocus(); | 43 | m_field->setFocus(); |
46 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 44 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
47 | settingsChanged(); | 45 | settingsChanged(); |
48 | } | 46 | } |
49 | 47 | ||
50 | void IRCChannelTab::scrolling(){ | 48 | void IRCChannelTab::scrolling(){ |
51 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 49 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
52 | } | 50 | } |
53 | 51 | ||
54 | void IRCChannelTab::appendText(QString text) { | 52 | void IRCChannelTab::appendText(QString text) { |
55 | /* not using append because it creates layout problems */ | 53 | /* not using append because it creates layout problems */ |
56 | QString txt = m_textview->text() + text + "\n"; | 54 | QString txt = m_textview->text() + text + "\n"; |
57 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | 55 | if (m_maxLines > 0 && m_lines >= m_maxLines) { |
58 | int firstBreak = txt.find('\n'); | 56 | int firstBreak = txt.find('\n'); |
59 | if (firstBreak != -1) { | 57 | if (firstBreak != -1) { |
60 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | 58 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); |
61 | } | 59 | } |
62 | } else { | 60 | } else { |
63 | m_lines++; | 61 | m_lines++; |
64 | } | 62 | } |
65 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 63 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
66 | m_textview->setText(txt); | 64 | m_textview->setText(txt); |
67 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 65 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
68 | emit changed(this); | 66 | emit changed(this); |
69 | } | 67 | } |
70 | 68 | ||
71 | IRCChannelTab::~IRCChannelTab() { | 69 | IRCChannelTab::~IRCChannelTab() { |
72 | m_parentTab->removeChannelTab(this); | 70 | m_parentTab->removeChannelTab(this); |
73 | } | 71 | } |
74 | 72 | ||
75 | void IRCChannelTab::processCommand() { | 73 | void IRCChannelTab::processCommand() { |
76 | QString text = m_field->text(); | 74 | QString text = m_field->text(); |
77 | if (text.length()>0) { | 75 | if (text.length()>0) { |
78 | if (session()->isSessionActive()) { | 76 | if (session()->isSessionActive()) { |
79 | if (text.startsWith("/") && !text.startsWith("//")) { | 77 | if (text.startsWith("/") && !text.startsWith("//")) { |
80 | /* Command mode */ | 78 | /* Command mode */ |
81 | m_parentTab->executeCommand(this, text);; | 79 | m_parentTab->executeCommand(this, text);; |
82 | } else { | 80 | } else { |
83 | if (text.startsWith("//")) | 81 | if (text.startsWith("//")) |
84 | text = text.right(text.length()-1); | 82 | text = text.right(text.length()-1); |
85 | session()->sendMessage(m_channel, m_field->text()); | 83 | session()->sendMessage(m_channel, m_field->text()); |
86 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); | 84 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); |
87 | } | 85 | } |
88 | } else { | 86 | } else { |
89 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); | 87 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); |
90 | } | 88 | } |
91 | } | 89 | } |
92 | m_field->clear(); | 90 | m_field->clear(); |
93 | } | 91 | } |
94 | 92 | ||
95 | void IRCChannelTab::settingsChanged() { | 93 | void IRCChannelTab::settingsChanged() { |
96 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 94 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
97 | m_lines = 0; | 95 | m_lines = 0; |
98 | } | 96 | } |
99 | 97 | ||
100 | void IRCChannelTab::toggleList() { | 98 | void IRCChannelTab::toggleList() { |
101 | if (m_listVisible) { | 99 | if (m_listVisible) { |
102 | m_list->setMaximumWidth(0); | 100 | m_list->setMaximumWidth(0); |
103 | m_listButton->setText("<"); | 101 | m_listButton->setText("<"); |
104 | } else { | 102 | } else { |
105 | m_list->setMaximumWidth(LISTWIDTH); | 103 | m_list->setMaximumWidth(LISTWIDTH); |
106 | m_listButton->setText(">"); | 104 | m_listButton->setText(">"); |
107 | } | 105 | } |
108 | m_listVisible = !m_listVisible; | 106 | m_listVisible = !m_listVisible; |
109 | } | 107 | } |
110 | 108 | ||
111 | void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { | 109 | void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { |
112 | switch (mouse) { | 110 | switch (mouse) { |
113 | case 1: | 111 | case 1: |
114 | break; | 112 | break; |
115 | case 2: | 113 | case 2: |
116 | m_popup->popup(point); | 114 | m_popup->popup(point); |
117 | break; | 115 | break; |
118 | }; | 116 | }; |
119 | } | 117 | } |
120 | 118 | ||
121 | void IRCChannelTab::popupQuery() { | 119 | void IRCChannelTab::popupQuery() { |
122 | if (m_list->currentItem() != -1) { | 120 | if (m_list->currentItem() != -1) { |
123 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); | 121 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); |
124 | if (person) { | 122 | if (person) { |
125 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); | 123 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); |
126 | if (!tab) { | 124 | if (!tab) { |
127 | tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); | 125 | tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); |
128 | m_parentTab->addQueryTab(tab); | 126 | m_parentTab->addQueryTab(tab); |
129 | m_mainWindow->addTab(tab); | 127 | m_mainWindow->addTab(tab); |
130 | } | 128 | } |
131 | } | 129 | } |
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp index a15a790..22387b3 100644 --- a/noncore/net/opieirc/ircmisc.cpp +++ b/noncore/net/opieirc/ircmisc.cpp | |||
@@ -1,84 +1,83 @@ | |||
1 | #include <qlayout.h> | ||
2 | #include <stdio.h> | 1 | #include <stdio.h> |
3 | #include "ircmisc.h" | 2 | #include "ircmisc.h" |
4 | 3 | ||
5 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { | 4 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { |
6 | } | 5 | } |
7 | 6 | ||
8 | int IRCTabBar::insertTab(QTab *tab, int index) { | 7 | int IRCTabBar::insertTab(QTab *tab, int index) { |
9 | /* FIXME: find some nicer way to do this */ | 8 | /* FIXME: find some nicer way to do this */ |
10 | QExtTab *ext = new QExtTab(); | 9 | QExtTab *ext = new QExtTab(); |
11 | ext->color = black; | 10 | ext->color = black; |
12 | ext->label = tab->text(); | 11 | ext->label = tab->text(); |
13 | ext->r = tab->rect(); | 12 | ext->r = tab->rect(); |
14 | ext->enabled = tab->isEnabled(); | 13 | ext->enabled = tab->isEnabled(); |
15 | ext->iconset = tab->iconSet(); | 14 | ext->iconset = tab->iconSet(); |
16 | delete tab; | 15 | delete tab; |
17 | return QTabBar::insertTab(ext, index); | 16 | return QTabBar::insertTab(ext, index); |
18 | } | 17 | } |
19 | 18 | ||
20 | void IRCTabBar::setTabColor(int index, QColor color) { | 19 | void IRCTabBar::setTabColor(int index, QColor color) { |
21 | ((QExtTab *)tab(index))->color = color; | 20 | ((QExtTab *)tab(index))->color = color; |
22 | update(); | 21 | update(); |
23 | } | 22 | } |
24 | 23 | ||
25 | void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { | 24 | void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { |
26 | QRect r = br; | 25 | QRect r = br; |
27 | QTabBar::paintLabel(p, br, t, focus); | 26 | QTabBar::paintLabel(p, br, t, focus); |
28 | if (t->id == currentTab()) | 27 | if (t->id == currentTab()) |
29 | r.setBottom(r.bottom() - style().defaultFrameWidth()); | 28 | r.setBottom(r.bottom() - style().defaultFrameWidth()); |
30 | p->setPen(((QExtTab *)t)->color); | 29 | p->setPen(((QExtTab *)t)->color); |
31 | p->drawText(r, AlignCenter | ShowPrefix, t->label); | 30 | p->drawText(r, AlignCenter | ShowPrefix, t->label); |
32 | } | 31 | } |
33 | 32 | ||
34 | IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { | 33 | IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { |
35 | setTabBar(new IRCTabBar(this, "tab control")); | 34 | setTabBar(new IRCTabBar(this, "tab control")); |
36 | } | 35 | } |
37 | 36 | ||
38 | void IRCTabWidget::setTabColor(int index, QColor color) { | 37 | void IRCTabWidget::setTabColor(int index, QColor color) { |
39 | ((IRCTabBar *)tabBar())->setTabColor(index, color); | 38 | ((IRCTabBar *)tabBar())->setTabColor(index, color); |
40 | } | 39 | } |
41 | 40 | ||
42 | 41 | ||
43 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { | 42 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { |
44 | m_index = -1; | 43 | m_index = -1; |
45 | installEventFilter(this); | 44 | installEventFilter(this); |
46 | } | 45 | } |
47 | 46 | ||
48 | void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { | 47 | void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { |
49 | int key = event->key(); | 48 | int key = event->key(); |
50 | if (key == Key_Up) { | 49 | if (key == Key_Up) { |
51 | if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { | 50 | if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { |
52 | m_index++; | 51 | m_index++; |
53 | setText(m_history[m_index]); | 52 | setText(m_history[m_index]); |
54 | } | 53 | } |
55 | } else if (key == Key_Down) { | 54 | } else if (key == Key_Down) { |
56 | if (m_history.count() > 0 && m_index > 0) { | 55 | if (m_history.count() > 0 && m_index > 0) { |
57 | m_index--; | 56 | m_index--; |
58 | setText(m_history[m_index]); | 57 | setText(m_history[m_index]); |
59 | } | 58 | } |
60 | if (m_index == 0) { | 59 | if (m_index == 0) { |
61 | m_index = -1; | 60 | m_index = -1; |
62 | setText(""); | 61 | setText(""); |
63 | } | 62 | } |
64 | } else if (key == Key_Return) { | 63 | } else if (key == Key_Return) { |
65 | m_history.prepend(text()); | 64 | m_history.prepend(text()); |
66 | m_index = -1; | 65 | m_index = -1; |
67 | } else if (key == Key_Tab) { | 66 | } else if (key == Key_Tab) { |
68 | printf("got tab\n"); | 67 | printf("got tab\n"); |
69 | return; | 68 | return; |
70 | } | 69 | } |
71 | QLineEdit::keyPressEvent(event); | 70 | QLineEdit::keyPressEvent(event); |
72 | } | 71 | } |
73 | 72 | ||
74 | bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { | 73 | bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { |
75 | if (event->type() == QEvent::KeyPress) { | 74 | if (event->type() == QEvent::KeyPress) { |
76 | QKeyEvent *k = (QKeyEvent *) event; | 75 | QKeyEvent *k = (QKeyEvent *) event; |
77 | /* Catch tab characters */ | 76 | /* Catch tab characters */ |
78 | if (k->key() == Key_Tab) { | 77 | if (k->key() == Key_Tab) { |
79 | qDebug("tab!"); | 78 | qDebug("tab!"); |
80 | return TRUE; | 79 | return TRUE; |
81 | } | 80 | } |
82 | } | 81 | } |
83 | return QLineEdit::eventFilter(object, event); | 82 | return QLineEdit::eventFilter(object, event); |
84 | } | 83 | } |
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 2c28507..d1aab40 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -1,129 +1,128 @@ | |||
1 | #include <qpe/config.h> | ||
2 | #include <qtextstream.h> | 1 | #include <qtextstream.h> |
3 | #include <qwhatsthis.h> | 2 | #include <qwhatsthis.h> |
4 | #include "ircservertab.h" | 3 | #include "ircservertab.h" |
5 | 4 | ||
6 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 5 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
7 | m_server = server; | 6 | m_server = server; |
8 | m_session = new IRCSession(&m_server); | 7 | m_session = new IRCSession(&m_server); |
9 | m_mainWindow = mainWindow; | 8 | m_mainWindow = mainWindow; |
10 | m_close = FALSE; | 9 | m_close = FALSE; |
11 | m_lines = 0; | 10 | m_lines = 0; |
12 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); | 11 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); |
13 | m_textview = new QTextView(this); | 12 | m_textview = new QTextView(this); |
14 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 13 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
15 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 14 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
16 | m_textview->setTextFormat(RichText); | 15 | m_textview->setTextFormat(RichText); |
17 | QWhatsThis::add(m_textview, tr("Server messages")); | 16 | QWhatsThis::add(m_textview, tr("Server messages")); |
18 | m_layout->add(m_textview); | 17 | m_layout->add(m_textview); |
19 | m_field = new IRCHistoryLineEdit(this); | 18 | m_field = new IRCHistoryLineEdit(this); |
20 | QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); | 19 | QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); |
21 | m_layout->add(m_field); | 20 | m_layout->add(m_field); |
22 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 21 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
23 | m_field->setFocus(); | 22 | m_field->setFocus(); |
24 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); | 23 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); |
25 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); | 24 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); |
26 | settingsChanged(); | 25 | settingsChanged(); |
27 | } | 26 | } |
28 | 27 | ||
29 | void IRCServerTab::scrolling(){ | 28 | void IRCServerTab::scrolling(){ |
30 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 29 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
31 | } | 30 | } |
32 | 31 | ||
33 | 32 | ||
34 | void IRCServerTab::appendText(QString text) { | 33 | void IRCServerTab::appendText(QString text) { |
35 | /* not using append because it creates layout problems */ | 34 | /* not using append because it creates layout problems */ |
36 | QString txt = m_textview->text() + text + "\n"; | 35 | QString txt = m_textview->text() + text + "\n"; |
37 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | 36 | if (m_maxLines > 0 && m_lines >= m_maxLines) { |
38 | int firstBreak = txt.find('\n'); | 37 | int firstBreak = txt.find('\n'); |
39 | if (firstBreak != -1) { | 38 | if (firstBreak != -1) { |
40 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | 39 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); |
41 | } | 40 | } |
42 | } else { | 41 | } else { |
43 | m_lines++; | 42 | m_lines++; |
44 | } | 43 | } |
45 | m_textview->setText(txt); | 44 | m_textview->setText(txt); |
46 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 45 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
47 | emit changed(this); | 46 | emit changed(this); |
48 | } | 47 | } |
49 | 48 | ||
50 | IRCServerTab::~IRCServerTab() { | 49 | IRCServerTab::~IRCServerTab() { |
51 | delete m_session; | 50 | delete m_session; |
52 | } | 51 | } |
53 | 52 | ||
54 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { | 53 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { |
55 | m_channelTabs.remove(tab); | 54 | m_channelTabs.remove(tab); |
56 | } | 55 | } |
57 | 56 | ||
58 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { | 57 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { |
59 | m_queryTabs.remove(tab); | 58 | m_queryTabs.remove(tab); |
60 | } | 59 | } |
61 | 60 | ||
62 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { | 61 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { |
63 | m_queryTabs.append(tab); | 62 | m_queryTabs.append(tab); |
64 | } | 63 | } |
65 | 64 | ||
66 | QString IRCServerTab::title() { | 65 | QString IRCServerTab::title() { |
67 | return "Server"; | 66 | return "Server"; |
68 | } | 67 | } |
69 | 68 | ||
70 | IRCSession *IRCServerTab::session() { | 69 | IRCSession *IRCServerTab::session() { |
71 | return m_session; | 70 | return m_session; |
72 | } | 71 | } |
73 | /* | 72 | /* |
74 | QString *IRCServerTab::mynick() { | 73 | QString *IRCServerTab::mynick() { |
75 | return (*m_server->nick()); | 74 | return (*m_server->nick()); |
76 | } */ | 75 | } */ |
77 | 76 | ||
78 | IRCServer *IRCServerTab::server() { | 77 | IRCServer *IRCServerTab::server() { |
79 | return &m_server; | 78 | return &m_server; |
80 | } | 79 | } |
81 | 80 | ||
82 | void IRCServerTab::settingsChanged() { | 81 | void IRCServerTab::settingsChanged() { |
83 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 82 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
84 | m_lines = 0; | 83 | m_lines = 0; |
85 | } | 84 | } |
86 | 85 | ||
87 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | 86 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { |
88 | QTextIStream stream(&line); | 87 | QTextIStream stream(&line); |
89 | QString command; | 88 | QString command; |
90 | stream >> command; | 89 | stream >> command; |
91 | command = command.upper().right(command.length()-1); | 90 | command = command.upper().right(command.length()-1); |
92 | 91 | ||
93 | //JOIN | 92 | //JOIN |
94 | if (command == "JOIN" || command == "J") { | 93 | if (command == "JOIN" || command == "J") { |
95 | QString channel; | 94 | QString channel; |
96 | stream >> channel; | 95 | stream >> channel; |
97 | if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { | 96 | if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { |
98 | m_session->join(channel); | 97 | m_session->join(channel); |
99 | } else { | 98 | } else { |
100 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); | 99 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); |
101 | } | 100 | } |
102 | } | 101 | } |
103 | 102 | ||
104 | //KICK | 103 | //KICK |
105 | else if (command == "KICK"){ | 104 | else if (command == "KICK"){ |
106 | QString nickname; | 105 | QString nickname; |
107 | stream >> nickname; | 106 | stream >> nickname; |
108 | if (nickname.length() > 0) { | 107 | if (nickname.length() > 0) { |
109 | if (line.length() > 7 + nickname.length()) { | 108 | if (line.length() > 7 + nickname.length()) { |
110 | QString text = line.right(line.length()-nickname.length()-7); | 109 | QString text = line.right(line.length()-nickname.length()-7); |
111 | IRCPerson person; | 110 | IRCPerson person; |
112 | person.setNick(nickname); | 111 | person.setNick(nickname); |
113 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); | 112 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); |
114 | } else { | 113 | } else { |
115 | IRCPerson person; | 114 | IRCPerson person; |
116 | person.setNick(nickname); | 115 | person.setNick(nickname); |
117 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person); | 116 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person); |
118 | } | 117 | } |
119 | } | 118 | } |
120 | } | 119 | } |
121 | 120 | ||
122 | else if (command == "OP"){ | 121 | else if (command == "OP"){ |
123 | QString nickname; | 122 | QString nickname; |
124 | stream >> nickname; | 123 | stream >> nickname; |
125 | if (nickname.length() > 0) { | 124 | if (nickname.length() > 0) { |
126 | QString text = line.right(line.length()-nickname.length()-5); | 125 | QString text = line.right(line.length()-nickname.length()-5); |
127 | IRCPerson person; | 126 | IRCPerson person; |
128 | person.setNick(nickname); | 127 | person.setNick(nickname); |
129 | m_session->op(((IRCChannelTab *)tab)->channel(), &person); | 128 | m_session->op(((IRCChannelTab *)tab)->channel(), &person); |
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp index 70d5445..2862296 100644 --- a/noncore/net/opieirc/ircsettings.cpp +++ b/noncore/net/opieirc/ircsettings.cpp | |||
@@ -1,101 +1,98 @@ | |||
1 | #include <opie/ocolorbutton.h> | 1 | #include <opie/ocolorbutton.h> |
2 | #include <opie/otabwidget.h> | 2 | #include <opie/otabwidget.h> |
3 | #include <qlayout.h> | ||
4 | #include <qvalidator.h> | 3 | #include <qvalidator.h> |
5 | #include <qscrollview.h> | ||
6 | #include <qwhatsthis.h> | 4 | #include <qwhatsthis.h> |
7 | #include "ircsettings.h" | 5 | #include "ircsettings.h" |
8 | #include "irctab.h" | 6 | #include "irctab.h" |
9 | #include "ircmisc.h" | ||
10 | 7 | ||
11 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { | 8 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { |
12 | setCaption(tr("Settings") ); | 9 | setCaption(tr("Settings") ); |
13 | m_config = new Config("OpieIRC"); | 10 | m_config = new Config("OpieIRC"); |
14 | m_config->setGroup("OpieIRC"); | 11 | m_config->setGroup("OpieIRC"); |
15 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); | 12 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); |
16 | OTabWidget *tw = new OTabWidget(this); | 13 | OTabWidget *tw = new OTabWidget(this); |
17 | l->addWidget(tw); | 14 | l->addWidget(tw); |
18 | /* General Configuration */ | 15 | /* General Configuration */ |
19 | QWidget *genwidget = new QWidget(tw); | 16 | QWidget *genwidget = new QWidget(tw); |
20 | QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0); | 17 | QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0); |
21 | QLabel *label = new QLabel(tr("Lines displayed :"), genwidget); | 18 | QLabel *label = new QLabel(tr("Lines displayed :"), genwidget); |
22 | layout->addWidget(label, 0, 0); | 19 | layout->addWidget(label, 0, 0); |
23 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget); | 20 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget); |
24 | QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this")); | 21 | QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this")); |
25 | QIntValidator *validator = new QIntValidator(this); | 22 | QIntValidator *validator = new QIntValidator(this); |
26 | validator->setTop(10000); | 23 | validator->setTop(10000); |
27 | validator->setBottom(0); | 24 | validator->setBottom(0); |
28 | m_lines->setValidator(validator); | 25 | m_lines->setValidator(validator); |
29 | layout->addWidget(m_lines, 0, 1); | 26 | layout->addWidget(m_lines, 0, 1); |
30 | tw->addTab(genwidget, "opieirc/settings", tr("General")); | 27 | tw->addTab(genwidget, "opieirc/settings", tr("General")); |
31 | 28 | ||
32 | /* Color configuration */ | 29 | /* Color configuration */ |
33 | QScrollView *view = new QScrollView(this); | 30 | QScrollView *view = new QScrollView(this); |
34 | view->setResizePolicy(QScrollView::AutoOneFit); | 31 | view->setResizePolicy(QScrollView::AutoOneFit); |
35 | view->setFrameStyle( QFrame::NoFrame ); | 32 | view->setFrameStyle( QFrame::NoFrame ); |
36 | QWidget *widget = new QWidget(view->viewport()); | 33 | QWidget *widget = new QWidget(view->viewport()); |
37 | view->addChild(widget); | 34 | view->addChild(widget); |
38 | layout = new QGridLayout(widget, 7, 2, 5, 0); | 35 | layout = new QGridLayout(widget, 7, 2, 5, 0); |
39 | label = new QLabel(tr("Background color :"), widget); | 36 | label = new QLabel(tr("Background color :"), widget); |
40 | layout->addWidget(label, 0, 0); | 37 | layout->addWidget(label, 0, 0); |
41 | m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF")); | 38 | m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF")); |
42 | QWhatsThis::add(m_background, tr("Background color to be used in chats")); | 39 | QWhatsThis::add(m_background, tr("Background color to be used in chats")); |
43 | layout->addWidget(m_background, 0, 1); | 40 | layout->addWidget(m_background, 0, 1); |
44 | label = new QLabel(tr("Normal text color :"), widget); | 41 | label = new QLabel(tr("Normal text color :"), widget); |
45 | layout->addWidget(label, 1, 0); | 42 | layout->addWidget(label, 1, 0); |
46 | m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000")); | 43 | m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000")); |
47 | QWhatsThis::add(m_text, tr("Text color to be used in chats")); | 44 | QWhatsThis::add(m_text, tr("Text color to be used in chats")); |
48 | layout->addWidget(m_text, 1, 1); | 45 | layout->addWidget(m_text, 1, 1); |
49 | label = new QLabel(tr("Error color :"), widget); | 46 | label = new QLabel(tr("Error color :"), widget); |
50 | layout->addWidget(label, 2, 0); | 47 | layout->addWidget(label, 2, 0); |
51 | m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000")); | 48 | m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000")); |
52 | QWhatsThis::add(m_error, tr("Text color to be used to display errors")); | 49 | QWhatsThis::add(m_error, tr("Text color to be used to display errors")); |
53 | layout->addWidget(m_error, 2, 1); | 50 | layout->addWidget(m_error, 2, 1); |
54 | label = new QLabel(tr("Text written by yourself :"), widget); | 51 | label = new QLabel(tr("Text written by yourself :"), widget); |
55 | layout->addWidget(label, 3, 0); | 52 | layout->addWidget(label, 3, 0); |
56 | m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000")); | 53 | m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000")); |
57 | QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself")); | 54 | QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself")); |
58 | layout->addWidget(m_self, 3, 1); | 55 | layout->addWidget(m_self, 3, 1); |
59 | label = new QLabel(tr("Text written by others :"), widget); | 56 | label = new QLabel(tr("Text written by others :"), widget); |
60 | layout->addWidget(label, 4, 0); | 57 | layout->addWidget(label, 4, 0); |
61 | m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB")); | 58 | m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB")); |
62 | QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others")); | 59 | QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others")); |
63 | layout->addWidget(m_other, 4, 1); | 60 | layout->addWidget(m_other, 4, 1); |
64 | label = new QLabel(tr("Text written by the server :"), widget); | 61 | label = new QLabel(tr("Text written by the server :"), widget); |
65 | layout->addWidget(label, 5, 0); | 62 | layout->addWidget(label, 5, 0); |
66 | m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF")); | 63 | m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF")); |
67 | QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server")); | 64 | QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server")); |
68 | layout->addWidget(m_server, 5, 1); | 65 | layout->addWidget(m_server, 5, 1); |
69 | label = new QLabel(tr("Notifications :"), widget); | 66 | label = new QLabel(tr("Notifications :"), widget); |
70 | layout->addWidget(label, 6, 0); | 67 | layout->addWidget(label, 6, 0); |
71 | m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#AAE300")); | 68 | m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#AAE300")); |
72 | QWhatsThis::add(m_notification, tr("Text color to be used to display notifications")); | 69 | QWhatsThis::add(m_notification, tr("Text color to be used to display notifications")); |
73 | layout->addWidget(m_notification, 6, 1); | 70 | layout->addWidget(m_notification, 6, 1); |
74 | tw->addTab(view, "opieirc/colors", tr("Colors")); | 71 | tw->addTab(view, "opieirc/colors", tr("Colors")); |
75 | tw->setCurrentTab( genwidget ); | 72 | tw->setCurrentTab( genwidget ); |
76 | showMaximized(); | 73 | showMaximized(); |
77 | } | 74 | } |
78 | 75 | ||
79 | void IRCSettings::accept() { | 76 | void IRCSettings::accept() { |
80 | IRCTab::m_backgroundColor = m_background->color().name(); | 77 | IRCTab::m_backgroundColor = m_background->color().name(); |
81 | IRCTab::m_textColor = m_text->color().name(); | 78 | IRCTab::m_textColor = m_text->color().name(); |
82 | IRCTab::m_errorColor = m_error->color().name(); | 79 | IRCTab::m_errorColor = m_error->color().name(); |
83 | IRCTab::m_selfColor = m_self->color().name(); | 80 | IRCTab::m_selfColor = m_self->color().name(); |
84 | IRCTab::m_otherColor = m_other->color().name(); | 81 | IRCTab::m_otherColor = m_other->color().name(); |
85 | IRCTab::m_serverColor = m_server->color().name(); | 82 | IRCTab::m_serverColor = m_server->color().name(); |
86 | IRCTab::m_notificationColor = m_notification->color().name(); | 83 | IRCTab::m_notificationColor = m_notification->color().name(); |
87 | IRCTab::m_maxLines = m_lines->text().toInt(); | 84 | IRCTab::m_maxLines = m_lines->text().toInt(); |
88 | m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); | 85 | m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); |
89 | m_config->writeEntry("TextColor", IRCTab::m_textColor); | 86 | m_config->writeEntry("TextColor", IRCTab::m_textColor); |
90 | m_config->writeEntry("ErrorColor", IRCTab::m_errorColor); | 87 | m_config->writeEntry("ErrorColor", IRCTab::m_errorColor); |
91 | m_config->writeEntry("SelfColor", IRCTab::m_selfColor); | 88 | m_config->writeEntry("SelfColor", IRCTab::m_selfColor); |
92 | m_config->writeEntry("OtherColor", IRCTab::m_otherColor); | 89 | m_config->writeEntry("OtherColor", IRCTab::m_otherColor); |
93 | m_config->writeEntry("ServerColor", IRCTab::m_serverColor); | 90 | m_config->writeEntry("ServerColor", IRCTab::m_serverColor); |
94 | m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor); | 91 | m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor); |
95 | m_config->writeEntry("Lines", m_lines->text()); | 92 | m_config->writeEntry("Lines", m_lines->text()); |
96 | QDialog::accept(); | 93 | QDialog::accept(); |
97 | } | 94 | } |
98 | 95 | ||
99 | IRCSettings::~IRCSettings() { | 96 | IRCSettings::~IRCSettings() { |
100 | delete m_config; | 97 | delete m_config; |
101 | } | 98 | } |
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp index 8a869d6..3351c3b 100644 --- a/noncore/net/opieirc/irctab.cpp +++ b/noncore/net/opieirc/irctab.cpp | |||
@@ -1,39 +1,38 @@ | |||
1 | #include <qpe/resource.h> | 1 | #include <qpe/resource.h> |
2 | #include <qpixmap.h> | ||
3 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
4 | #include <qwhatsthis.h> | 3 | #include <qwhatsthis.h> |
5 | #include "irctab.h" | 4 | #include "irctab.h" |
6 | 5 | ||
7 | QString IRCTab::m_errorColor; | 6 | QString IRCTab::m_errorColor; |
8 | QString IRCTab::m_serverColor; | 7 | QString IRCTab::m_serverColor; |
9 | QString IRCTab::m_textColor; | 8 | QString IRCTab::m_textColor; |
10 | QString IRCTab::m_backgroundColor; | 9 | QString IRCTab::m_backgroundColor; |
11 | QString IRCTab::m_selfColor; | 10 | QString IRCTab::m_selfColor; |
12 | QString IRCTab::m_otherColor; | 11 | QString IRCTab::m_otherColor; |
13 | QString IRCTab::m_notificationColor; | 12 | QString IRCTab::m_notificationColor; |
14 | int IRCTab::m_maxLines; | 13 | int IRCTab::m_maxLines; |
15 | 14 | ||
16 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { | 15 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { |
17 | m_layout = new QVBoxLayout(this); | 16 | m_layout = new QVBoxLayout(this); |
18 | QHBoxLayout *descLayout = new QHBoxLayout(m_layout); | 17 | QHBoxLayout *descLayout = new QHBoxLayout(m_layout); |
19 | descLayout->setMargin(5); | 18 | descLayout->setMargin(5); |
20 | m_description = new QLabel(tr("Missing description"), this); | 19 | m_description = new QLabel(tr("Missing description"), this); |
21 | QWhatsThis::add(m_description, tr("Description of the tab's content")); | 20 | QWhatsThis::add(m_description, tr("Description of the tab's content")); |
22 | descLayout->addWidget(m_description); | 21 | descLayout->addWidget(m_description); |
23 | descLayout->setStretchFactor(m_description, 5); | 22 | descLayout->setStretchFactor(m_description, 5); |
24 | QPushButton *close = new QPushButton(this); | 23 | QPushButton *close = new QPushButton(this); |
25 | QWhatsThis::add(close, tr("Close this tab")); | 24 | QWhatsThis::add(close, tr("Close this tab")); |
26 | close->setPixmap(Resource::loadPixmap("close")); | 25 | close->setPixmap(Resource::loadPixmap("close")); |
27 | connect(close, SIGNAL(clicked()), this, SLOT(remove())); | 26 | connect(close, SIGNAL(clicked()), this, SLOT(remove())); |
28 | descLayout->addWidget(close); | 27 | descLayout->addWidget(close); |
29 | descLayout->setStretchFactor(m_description, 1); | 28 | descLayout->setStretchFactor(m_description, 1); |
30 | } | 29 | } |
31 | 30 | ||
32 | 31 | ||
33 | void IRCTab::setID(int id) { | 32 | void IRCTab::setID(int id) { |
34 | m_id = id; | 33 | m_id = id; |
35 | } | 34 | } |
36 | 35 | ||
37 | int IRCTab::id() { | 36 | int IRCTab::id() { |
38 | return m_id; | 37 | return m_id; |
39 | } | 38 | } |
diff --git a/noncore/net/opieirc/main.cpp b/noncore/net/opieirc/main.cpp index 39acfcc..da38024 100644 --- a/noncore/net/opieirc/main.cpp +++ b/noncore/net/opieirc/main.cpp | |||
@@ -1,7 +1,6 @@ | |||
1 | #include <qpe/qpeapplication.h> | ||
2 | #include "mainwindow.h" | 1 | #include "mainwindow.h" |
3 | 2 | ||
4 | #include <opie/oapplicationfactory.h> | 3 | #include <opie/oapplicationfactory.h> |
5 | 4 | ||
6 | 5 | ||
7 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) | 6 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) |
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index be6f8ed..7414154 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -1,93 +1,91 @@ | |||
1 | #include <qmenubar.h> | 1 | #include <qmenubar.h> |
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qpe/config.h> | ||
4 | #include <qpopupmenu.h> | ||
5 | #include <qwhatsthis.h> | 3 | #include <qwhatsthis.h> |
6 | 4 | ||
7 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
8 | #include "ircservertab.h" | 6 | #include "ircservertab.h" |
9 | #include "ircserverlist.h" | 7 | #include "ircserverlist.h" |
10 | #include "ircsettings.h" | 8 | #include "ircsettings.h" |
11 | 9 | ||
12 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 10 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
13 | setCaption(tr("IRC Client")); | 11 | setCaption(tr("IRC Client")); |
14 | m_tabWidget = new IRCTabWidget(this); | 12 | m_tabWidget = new IRCTabWidget(this); |
15 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); | 13 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); |
16 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); | 14 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); |
17 | setCentralWidget(m_tabWidget); | 15 | setCentralWidget(m_tabWidget); |
18 | setToolBarsMovable(FALSE); | 16 | setToolBarsMovable(FALSE); |
19 | QMenuBar *menuBar = new QMenuBar(this); | 17 | QMenuBar *menuBar = new QMenuBar(this); |
20 | QPopupMenu *irc = new QPopupMenu(this); | 18 | QPopupMenu *irc = new QPopupMenu(this); |
21 | menuBar->insertItem(tr("IRC"), irc); | 19 | menuBar->insertItem(tr("IRC"), irc); |
22 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); | 20 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); |
23 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); | 21 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); |
24 | a->setWhatsThis(tr("Create a new connection to an IRC server")); | 22 | a->setWhatsThis(tr("Create a new connection to an IRC server")); |
25 | a->addTo(irc); | 23 | a->addTo(irc); |
26 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); | 24 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); |
27 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); | 25 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); |
28 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | 26 | connect(a, SIGNAL(activated()), this, SLOT(settings())); |
29 | a->addTo(irc); | 27 | a->addTo(irc); |
30 | loadSettings(); | 28 | loadSettings(); |
31 | } | 29 | } |
32 | 30 | ||
33 | /*IRCTabWidget MainWindow::getTabWidget(){ | 31 | /*IRCTabWidget MainWindow::getTabWidget(){ |
34 | return m_tabWidget; | 32 | return m_tabWidget; |
35 | } */ | 33 | } */ |
36 | 34 | ||
37 | void MainWindow::loadSettings() { | 35 | void MainWindow::loadSettings() { |
38 | Config config("OpieIRC"); | 36 | Config config("OpieIRC"); |
39 | config.setGroup("OpieIRC"); | 37 | config.setGroup("OpieIRC"); |
40 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); | 38 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
41 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); | 39 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
42 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); | 40 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
43 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); | 41 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
44 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); | 42 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
45 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 43 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
46 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 44 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
47 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | 45 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); |
48 | } | 46 | } |
49 | 47 | ||
50 | void MainWindow::selected(QWidget *) { | 48 | void MainWindow::selected(QWidget *) { |
51 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); | 49 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
52 | emit updateScroll(); | 50 | emit updateScroll(); |
53 | } | 51 | } |
54 | 52 | ||
55 | void MainWindow::addTab(IRCTab *tab) { | 53 | void MainWindow::addTab(IRCTab *tab) { |
56 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); | 54 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); |
57 | m_tabWidget->addTab(tab, tab->title()); | 55 | m_tabWidget->addTab(tab, tab->title()); |
58 | m_tabWidget->showPage(tab); | 56 | m_tabWidget->showPage(tab); |
59 | tab->setID(m_tabWidget->currentPageIndex()); | 57 | tab->setID(m_tabWidget->currentPageIndex()); |
60 | m_tabs.append(tab); | 58 | m_tabs.append(tab); |
61 | } | 59 | } |
62 | 60 | ||
63 | void MainWindow::changeEvent(IRCTab *tab) { | 61 | void MainWindow::changeEvent(IRCTab *tab) { |
64 | if (tab->id() != m_tabWidget->currentPageIndex()) | 62 | if (tab->id() != m_tabWidget->currentPageIndex()) |
65 | m_tabWidget->setTabColor(tab->id(), blue); | 63 | m_tabWidget->setTabColor(tab->id(), blue); |
66 | } | 64 | } |
67 | 65 | ||
68 | void MainWindow::killTab(IRCTab *tab) { | 66 | void MainWindow::killTab(IRCTab *tab) { |
69 | m_tabWidget->removePage(tab); | 67 | m_tabWidget->removePage(tab); |
70 | m_tabs.remove(tab); | 68 | m_tabs.remove(tab); |
71 | /* there might be nicer ways to do this .. */ | 69 | /* there might be nicer ways to do this .. */ |
72 | delete tab; | 70 | delete tab; |
73 | } | 71 | } |
74 | 72 | ||
75 | void MainWindow::newConnection() { | 73 | void MainWindow::newConnection() { |
76 | IRCServerList list(this, "ServerList", TRUE); | 74 | IRCServerList list(this, "ServerList", TRUE); |
77 | if (list.exec() == QDialog::Accepted && list.hasServer()) { | 75 | if (list.exec() == QDialog::Accepted && list.hasServer()) { |
78 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); | 76 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); |
79 | addTab(serverTab); | 77 | addTab(serverTab); |
80 | serverTab->doConnect(); | 78 | serverTab->doConnect(); |
81 | } | 79 | } |
82 | } | 80 | } |
83 | 81 | ||
84 | void MainWindow::settings() { | 82 | void MainWindow::settings() { |
85 | IRCSettings settings(this, "Settings", TRUE); | 83 | IRCSettings settings(this, "Settings", TRUE); |
86 | if (settings.exec() == QDialog::Accepted) { | 84 | if (settings.exec() == QDialog::Accepted) { |
87 | QListIterator<IRCTab> it(m_tabs); | 85 | QListIterator<IRCTab> it(m_tabs); |
88 | for (; it.current(); ++it) { | 86 | for (; it.current(); ++it) { |
89 | /* Inform all tabs about the new settings */ | 87 | /* Inform all tabs about the new settings */ |
90 | it.current()->settingsChanged(); | 88 | it.current()->settingsChanged(); |
91 | } | 89 | } |
92 | } | 90 | } |
93 | } | 91 | } |