summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/mainwindow.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 7414154..0923a11 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -1,78 +1,78 @@
1#include <qmenubar.h> 1#include <qmenubar.h>
2#include <qpe/resource.h> 2#include <qpe/resource.h>
3#include <qwhatsthis.h> 3#include <qwhatsthis.h>
4 4
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include "ircservertab.h" 6#include "ircservertab.h"
7#include "ircserverlist.h" 7#include "ircserverlist.h"
8#include "ircsettings.h" 8#include "ircsettings.h"
9 9
10MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 10MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
11 setCaption(tr("IRC Client")); 11 setCaption(tr("IRC Client"));
12 m_tabWidget = new IRCTabWidget(this); 12 m_tabWidget = new IRCTabWidget(this);
13 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"));
14 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); 14 connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*)));
15 setCentralWidget(m_tabWidget); 15 setCentralWidget(m_tabWidget);
16 setToolBarsMovable(FALSE); 16 setToolBarsMovable(FALSE);
17 QMenuBar *menuBar = new QMenuBar(this); 17 QMenuBar *menuBar = new QMenuBar(this);
18 QPopupMenu *irc = new QPopupMenu(this); 18 QPopupMenu *irc = new QPopupMenu(this);
19 menuBar->insertItem(tr("IRC"), irc); 19 menuBar->insertItem(tr("IRC"), irc);
20 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);
21 connect(a, SIGNAL(activated()), this, SLOT(newConnection())); 21 connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
22 a->setWhatsThis(tr("Create a new connection to an IRC server")); 22 a->setWhatsThis(tr("Create a new connection to an IRC server"));
23 a->addTo(irc); 23 a->addTo(irc);
24 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);
25 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); 25 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
26 connect(a, SIGNAL(activated()), this, SLOT(settings())); 26 connect(a, SIGNAL(activated()), this, SLOT(settings()));
27 a->addTo(irc); 27 a->addTo(irc);
28 loadSettings(); 28 loadSettings();
29} 29}
30 30
31/*IRCTabWidget MainWindow::getTabWidget(){ 31/*IRCTabWidget MainWindow::getTabWidget(){
32 return m_tabWidget; 32 return m_tabWidget;
33} */ 33} */
34 34
35void MainWindow::loadSettings() { 35void MainWindow::loadSettings() {
36 Config config("OpieIRC"); 36 Config config("OpieIRC");
37 config.setGroup("OpieIRC"); 37 config.setGroup("OpieIRC");
38 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); 38 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
39 IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); 39 IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
40 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); 40 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
41 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); 41 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
42 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); 42 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
43 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); 43 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
44 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); 44 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
45 IRCTab::m_maxLines = config.readNumEntry("Lines", 100); 45 IRCTab::m_maxLines = config.readNumEntry("Lines", 100);
46} 46}
47 47
48void MainWindow::selected(QWidget *) { 48void MainWindow::selected(QWidget *) {
49 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); 49 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
50 emit updateScroll(); 50 emit updateScroll();
51} 51}
52 52
53void MainWindow::addTab(IRCTab *tab) { 53void MainWindow::addTab(IRCTab *tab) {
54 connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); 54 connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*)));
55 m_tabWidget->addTab(tab, tab->title()); 55 m_tabWidget->addTab(tab, tab->title());
56 m_tabWidget->showPage(tab); 56 m_tabWidget->showPage(tab);
57 tab->setID(m_tabWidget->currentPageIndex()); 57 tab->setID(m_tabWidget->currentPageIndex());
58 m_tabs.append(tab); 58 m_tabs.append(tab);
59} 59}
60 60
61void MainWindow::changeEvent(IRCTab *tab) { 61void MainWindow::changeEvent(IRCTab *tab) {
62 if (tab->id() != m_tabWidget->currentPageIndex()) 62 if (tab->id() != m_tabWidget->currentPageIndex())
63 m_tabWidget->setTabColor(tab->id(), blue); 63 m_tabWidget->setTabColor(tab->id(), blue);
64} 64}
65 65
66void MainWindow::killTab(IRCTab *tab) { 66void MainWindow::killTab(IRCTab *tab) {
67 m_tabWidget->removePage(tab); 67 m_tabWidget->removePage(tab);
68 m_tabs.remove(tab); 68 m_tabs.remove(tab);
69 /* there might be nicer ways to do this .. */ 69 /* there might be nicer ways to do this .. */
70 delete tab; 70 delete tab;
71} 71}
72 72
73void MainWindow::newConnection() { 73void MainWindow::newConnection() {
74 IRCServerList list(this, "ServerList", TRUE); 74 IRCServerList list(this, "ServerList", TRUE);
75 if (list.exec() == QDialog::Accepted && list.hasServer()) { 75 if (list.exec() == QDialog::Accepted && list.hasServer()) {
76 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); 76 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget);
77 addTab(serverTab); 77 addTab(serverTab);
78 serverTab->doConnect(); 78 serverTab->doConnect();