Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index af4ce78..d78e5ab 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -7,9 +7,9 @@ | |||
7 | #include "ircservertab.h" | 7 | #include "ircservertab.h" |
8 | #include "ircserverlist.h" | 8 | #include "ircserverlist.h" |
9 | #include "ircsettings.h" | ||
9 | 10 | ||
10 | 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) { |
11 | setCaption(tr("IRC Client")); | 12 | setCaption(tr("IRC Client")); |
12 | m_tabWidget = new QTabWidget(this); | 13 | m_tabWidget = new QTabWidget(this); |
13 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabSelected(QWidget *))); | ||
14 | setCentralWidget(m_tabWidget); | 14 | setCentralWidget(m_tabWidget); |
15 | setToolBarsMovable(FALSE); | 15 | setToolBarsMovable(FALSE); |
@@ -20,16 +20,20 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindo | |||
20 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); | 20 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); |
21 | a->addTo(irc); | 21 | a->addTo(irc); |
22 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); | ||
23 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | ||
24 | a->addTo(irc); | ||
25 | loadSettings(); | ||
22 | } | 26 | } |
23 | 27 | ||
24 | void MainWindow::tabSelected(QWidget *) { | 28 | void MainWindow::loadSettings() { |
25 | } | 29 | Config config("OpieIRC"); |
26 | 30 | config.setGroup("OpieIRC"); | |
27 | void MainWindow::closeTab() { | 31 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
28 | /* Does not directly close the tab but triggers an action | 32 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
29 | which at some point will close the tab using a callback */ | 33 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
30 | IRCTab *tab = (IRCTab *)m_tabWidget->currentPage(); | 34 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
31 | if (tab) { | 35 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
32 | tab->remove(); | 36 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
33 | } | 37 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
34 | } | 38 | } |
35 | 39 | ||
@@ -37,9 +41,10 @@ void MainWindow::addTab(IRCTab *tab) { | |||
37 | m_tabWidget->addTab(tab, tab->title()); | 41 | m_tabWidget->addTab(tab, tab->title()); |
38 | m_tabWidget->showPage(tab); | 42 | m_tabWidget->showPage(tab); |
39 | tabSelected(tab); | 43 | m_tabs.append(tab); |
40 | } | 44 | } |
41 | 45 | ||
42 | void MainWindow::killTab(IRCTab *tab) { | 46 | void MainWindow::killTab(IRCTab *tab) { |
43 | m_tabWidget->removePage(tab); | 47 | m_tabWidget->removePage(tab); |
48 | m_tabs.remove(tab); | ||
44 | /* there might be nicer ways to do this .. */ | 49 | /* there might be nicer ways to do this .. */ |
45 | delete tab; | 50 | delete tab; |
@@ -54,2 +59,13 @@ void MainWindow::newConnection() { | |||
54 | } | 59 | } |
55 | } | 60 | } |
61 | |||
62 | void MainWindow::settings() { | ||
63 | IRCSettings settings(this, "Settings", TRUE); | ||
64 | if (settings.exec() == QDialog::Accepted) { | ||
65 | QListIterator<IRCTab> it(m_tabs); | ||
66 | for (; it.current(); ++it) { | ||
67 | /* Inform all tabs about the new settings */ | ||
68 | it.current()->settingsChanged(); | ||
69 | } | ||
70 | } | ||
71 | } | ||