Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index fe59c3b..bb03a1c 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -1,83 +1,84 @@ | |||
1 | #include <qpe/qpemenubar.h> | 1 | #include <qpe/qpemenubar.h> |
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | 5 | ||
6 | #include "mainwindow.h" | 6 | #include "mainwindow.h" |
7 | #include "ircservertab.h" | 7 | #include "ircservertab.h" |
8 | #include "ircserverlist.h" | 8 | #include "ircserverlist.h" |
9 | #include "ircsettings.h" | 9 | #include "ircsettings.h" |
10 | 10 | ||
11 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { | 11 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { |
12 | setCaption(tr("IRC Client")); | 12 | setCaption(tr("IRC Client")); |
13 | m_tabWidget = new IRCTabWidget(this); | 13 | m_tabWidget = new IRCTabWidget(this); |
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 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 17 | QPEMenuBar *menuBar = new QPEMenuBar(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->addTo(irc); | 22 | a->addTo(irc); |
23 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); | 23 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); |
24 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | 24 | connect(a, SIGNAL(activated()), this, SLOT(settings())); |
25 | a->addTo(irc); | 25 | a->addTo(irc); |
26 | loadSettings(); | 26 | loadSettings(); |
27 | } | 27 | } |
28 | 28 | ||
29 | void MainWindow::loadSettings() { | 29 | void MainWindow::loadSettings() { |
30 | Config config("OpieIRC"); | 30 | Config config("OpieIRC"); |
31 | config.setGroup("OpieIRC"); | 31 | config.setGroup("OpieIRC"); |
32 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); | 32 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
33 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); | 33 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
34 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); | 34 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
35 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); | 35 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
36 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); | 36 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
37 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 37 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
38 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 38 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
39 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | ||
39 | } | 40 | } |
40 | 41 | ||
41 | void MainWindow::selected(QWidget *) { | 42 | void MainWindow::selected(QWidget *) { |
42 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), &black); | 43 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
43 | } | 44 | } |
44 | 45 | ||
45 | void MainWindow::addTab(IRCTab *tab) { | 46 | void MainWindow::addTab(IRCTab *tab) { |
46 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); | 47 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); |
47 | m_tabWidget->addTab(tab, tab->title()); | 48 | m_tabWidget->addTab(tab, tab->title()); |
48 | m_tabWidget->showPage(tab); | 49 | m_tabWidget->showPage(tab); |
49 | tab->setID(m_tabWidget->currentPageIndex()); | 50 | tab->setID(m_tabWidget->currentPageIndex()); |
50 | m_tabs.append(tab); | 51 | m_tabs.append(tab); |
51 | } | 52 | } |
52 | 53 | ||
53 | void MainWindow::changeEvent(IRCTab *tab) { | 54 | void MainWindow::changeEvent(IRCTab *tab) { |
54 | if (tab->id() != m_tabWidget->currentPageIndex()) | 55 | if (tab->id() != m_tabWidget->currentPageIndex()) |
55 | m_tabWidget->setTabColor(tab->id(), &blue); | 56 | m_tabWidget->setTabColor(tab->id(), blue); |
56 | } | 57 | } |
57 | 58 | ||
58 | void MainWindow::killTab(IRCTab *tab) { | 59 | void MainWindow::killTab(IRCTab *tab) { |
59 | m_tabWidget->removePage(tab); | 60 | m_tabWidget->removePage(tab); |
60 | m_tabs.remove(tab); | 61 | m_tabs.remove(tab); |
61 | /* there might be nicer ways to do this .. */ | 62 | /* there might be nicer ways to do this .. */ |
62 | delete tab; | 63 | delete tab; |
63 | } | 64 | } |
64 | 65 | ||
65 | void MainWindow::newConnection() { | 66 | void MainWindow::newConnection() { |
66 | IRCServerList list(this, "ServerList", TRUE); | 67 | IRCServerList list(this, "ServerList", TRUE); |
67 | if (list.exec() == QDialog::Accepted && list.hasServer()) { | 68 | if (list.exec() == QDialog::Accepted && list.hasServer()) { |
68 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); | 69 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); |
69 | addTab(serverTab); | 70 | addTab(serverTab); |
70 | serverTab->doConnect(); | 71 | serverTab->doConnect(); |
71 | } | 72 | } |
72 | } | 73 | } |
73 | 74 | ||
74 | void MainWindow::settings() { | 75 | void MainWindow::settings() { |
75 | IRCSettings settings(this, "Settings", TRUE); | 76 | IRCSettings settings(this, "Settings", TRUE); |
76 | if (settings.exec() == QDialog::Accepted) { | 77 | if (settings.exec() == QDialog::Accepted) { |
77 | QListIterator<IRCTab> it(m_tabs); | 78 | QListIterator<IRCTab> it(m_tabs); |
78 | for (; it.current(); ++it) { | 79 | for (; it.current(); ++it) { |
79 | /* Inform all tabs about the new settings */ | 80 | /* Inform all tabs about the new settings */ |
80 | it.current()->settingsChanged(); | 81 | it.current()->settingsChanged(); |
81 | } | 82 | } |
82 | } | 83 | } |
83 | } | 84 | } |