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.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 2e674c5..2562f33 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -45,43 +45,55 @@ void MainWindow::loadSettings() {
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");
IRCTab::m_maxLines = config.readNumEntry("Lines", 100);
+ IRCTab::setUseTimeStamps( config.readBoolEntry("DisplayTime", false ) );
}
void MainWindow::selected(QWidget *) {
m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
emit updateScroll();
}
void MainWindow::addTab(IRCTab *tab) {
connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*)));
connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&)));
connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab()));
connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab()));
- connect(tab, SIGNAL(closeTab()), this, SLOT(slotCloseTab()));
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);
+void MainWindow::killTab(IRCTab *tab, bool imediate) {
+ m_toDelete.append( tab );
- /* there might be nicer ways to do this .. */
- delete tab;
+ if ( imediate )
+ slotKillTabsLater();
+ else
+ QTimer::singleShot(0, this, SLOT(slotKillTabsLater()) );
+}
+
+void MainWindow::slotKillTabsLater() {
+ for ( QListIterator<IRCTab> it(m_toDelete); it.current(); ++it ) {
+ m_tabWidget->removePage( it.current() );
+ m_tabs.remove( it.current() );
+ }
+
+ m_toDelete.setAutoDelete( true );
+ m_toDelete.clear();
+ m_toDelete.setAutoDelete( false );
}
void MainWindow::newConnection() {
IRCServerList list(this, "ServerList", TRUE);
if (list.exec() == QDialog::Accepted && list.hasServer()) {
IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget);
@@ -114,16 +126,10 @@ void MainWindow::slotNextTab() {
void MainWindow::slotPrevTab() {
int i = m_tabWidget->currentPageIndex ();
if ( i > 1 )
m_tabWidget->setCurrentPage ( i-1 );
}
-void MainWindow::slotCloseTab() {
- IRCTab *tab = (IRCTab *) m_tabWidget->currentPage ();
- if ( tab )
- killTab ( tab );
-}
-
-void MainWindow::slotPing( const QString& channel ) {
+void MainWindow::slotPing( const QString& /*channel*/ ) {
raise();
}