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.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 1811a0c..3d60107 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -1,47 +1,52 @@
#include <qmenubar.h>
#include <qpe/resource.h>
#include <opie2/odebug.h>
#include <qwhatsthis.h>
#include "mainwindow.h"
#include "ircservertab.h"
+#include "dcctransfertab.h"
#include "ircserverlist.h"
#include "ircsettings.h"
+#include <stdio.h>
+
+
QString MainWindow::appCaption() {
return QObject::tr("Opie IRC");
}
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
setCaption(tr("IRC Client"));
m_tabWidget = new IRCTabWidget(this);
QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*)));
setCentralWidget(m_tabWidget);
setToolBarsMovable(FALSE);
QMenuBar *menuBar = new QMenuBar(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);
connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
a->setWhatsThis(tr("Create a new connection to an IRC server"));
a->addTo(irc);
a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0);
a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
connect(a, SIGNAL(activated()), this, SLOT(settings()));
a->addTo(irc);
+ m_dccTab = 0;
loadSettings();
}
/*IRCTabWidget MainWindow::getTabWidget(){
return m_tabWidget;
} */
void MainWindow::loadSettings() {
Config config("OpieIRC");
config.setGroup("OpieIRC");
IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
@@ -68,24 +73,27 @@ void MainWindow::addTab(IRCTab *tab) {
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, bool imediate) {
+ if (tab == m_dccTab)
+ m_dccTab = 0;
+
m_toDelete.append( 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() );
odebug << it.current() << oendl;
@@ -128,12 +136,24 @@ void MainWindow::slotNextTab() {
}
void MainWindow::slotPrevTab() {
int i = m_tabWidget->currentPageIndex ();
if ( i > 1 )
m_tabWidget->setCurrentPage ( i-1 );
}
void MainWindow::slotPing( const QString& /*channel*/ ) {
raise();
}
+void MainWindow::addDCC(DCCTransfer::Type type, Q_UINT32 ip4Addr, Q_UINT16 port,
+ const QString &filename, const QString &nickname, unsigned int size) {
+
+ if (!m_dccTab) {
+ m_dccTab = new DCCTransferTab(this);
+ addTab(m_dccTab);
+ m_dccTab->show();
+ }
+
+ m_dccTab->addTransfer(type, ip4Addr, port, filename, nickname, size);
+}
+