Diffstat (limited to 'noncore/net/opieirc/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index d78e5ab..fe59c3b 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp @@ -7,13 +7,14 @@ #include "ircservertab.h" #include "ircserverlist.h" #include "ircsettings.h" MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { setCaption(tr("IRC Client")); - m_tabWidget = new QTabWidget(this); + m_tabWidget = new IRCTabWidget(this); + connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); setCentralWidget(m_tabWidget); setToolBarsMovable(FALSE); QPEMenuBar *menuBar = new QPEMenuBar(this); QPopupMenu *irc = new QPopupMenu(this); menuBar->insertItem(tr("IRC"), irc); QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); @@ -34,18 +35,29 @@ void MainWindow::loadSettings() { 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"); } +void MainWindow::selected(QWidget *) { + m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), &black); +} + void MainWindow::addTab(IRCTab *tab) { + connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); m_tabWidget->addTab(tab, tab->title()); m_tabWidget->showPage(tab); + tab->setID(m_tabWidget->currentPageIndex()); m_tabs.append(tab); } +void MainWindow::changeEvent(IRCTab *tab) { + if (tab->id() != m_tabWidget->currentPageIndex()) + m_tabWidget->setTabColor(tab->id(), &blue); +} + void MainWindow::killTab(IRCTab *tab) { m_tabWidget->removePage(tab); m_tabs.remove(tab); /* there might be nicer ways to do this .. */ delete tab; } |