summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/mainwindow.cpp40
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
@@ -8,2 +8,3 @@
#include "ircserverlist.h"
+#include "ircsettings.h"
@@ -12,3 +13,2 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindo
m_tabWidget = new QTabWidget(this);
- connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabSelected(QWidget *)));
setCentralWidget(m_tabWidget);
@@ -21,14 +21,18 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindo
a->addTo(irc);
+ a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0);
+ connect(a, SIGNAL(activated()), this, SLOT(settings()));
+ a->addTo(irc);
+ loadSettings();
}
-void MainWindow::tabSelected(QWidget *) {
-}
-
-void MainWindow::closeTab() {
- /* Does not directly close the tab but triggers an action
- which at some point will close the tab using a callback */
- IRCTab *tab = (IRCTab *)m_tabWidget->currentPage();
- if (tab) {
- tab->remove();
- }
+void MainWindow::loadSettings() {
+ Config config("OpieIRC");
+ config.setGroup("OpieIRC");
+ IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
+ IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
+ IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
+ IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
+ IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
+ IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
+ IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
}
@@ -38,3 +42,3 @@ void MainWindow::addTab(IRCTab *tab) {
m_tabWidget->showPage(tab);
- tabSelected(tab);
+ m_tabs.append(tab);
}
@@ -43,2 +47,3 @@ void MainWindow::killTab(IRCTab *tab) {
m_tabWidget->removePage(tab);
+ m_tabs.remove(tab);
/* there might be nicer ways to do this .. */
@@ -55 +60,12 @@ void MainWindow::newConnection() {
}
+
+void MainWindow::settings() {
+ IRCSettings settings(this, "Settings", TRUE);
+ if (settings.exec() == QDialog::Accepted) {
+ QListIterator<IRCTab> it(m_tabs);
+ for (; it.current(); ++it) {
+ /* Inform all tabs about the new settings */
+ it.current()->settingsChanged();
+ }
+ }
+}