From ebb830522c9662bda4c4453e532bcc29631c5d60 Mon Sep 17 00:00:00 2001 From: zecke Date: Wed, 08 Sep 2004 21:51:06 +0000 Subject: -Close Tab Keyboard Accelerator with delayed deletion of the tab -Optionally add a TimeStamp to the Tab -Remove not implemented CTCP actions from the Channel PopupMenu -Give Focus to the Edit Line -Some more ping handling patch inspired and copied from zautrix fork --- (limited to 'noncore/net/opieirc/mainwindow.cpp') 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 @@ -48,6 +48,7 @@ void MainWindow::loadSettings() { 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 *) { @@ -60,7 +61,6 @@ void MainWindow::addTab(IRCTab *tab) { 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); @@ -73,12 +73,24 @@ void MainWindow::changeEvent(IRCTab *tab) { 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 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() { @@ -117,13 +129,7 @@ void MainWindow::slotPrevTab() { 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(); } -- cgit v0.9.0.2