00001 #include "irctab.h"
00002 #include "mainwindow.h"
00003
00004 #include <opie2/okeyconfigmanager.h>
00005 #include <opie2/oresource.h>
00006
00007 #include <qpe/applnk.h>
00008
00009 #include <qpushbutton.h>
00010 #include <qwhatsthis.h>
00011
00012
00013 QString IRCTab::m_errorColor;
00014 QString IRCTab::m_serverColor;
00015 QString IRCTab::m_textColor;
00016 QString IRCTab::m_backgroundColor;
00017 QString IRCTab::m_selfColor;
00018 QString IRCTab::m_otherColor;
00019 QString IRCTab::m_notificationColor;
00020 int IRCTab::m_maxLines;
00021
00022
00023 static bool g_useTime = false;
00024
00025 void IRCTab::setUseTimeStamps( bool b ) {
00026 g_useTime = b;
00027 }
00028
00029
00030 QString IRCTab::appendTimestamp( const QString& text ) {
00031 return g_useTime ?
00032 "[" +QTime::currentTime().toString()+"]" + text + "\n" :
00033 text + "\n";
00034
00035 }
00036
00037
00038 IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
00039 m_layout = new QVBoxLayout(this);
00040 QHBoxLayout *descLayout = new QHBoxLayout(m_layout);
00041 descLayout->setMargin(5);
00042 m_description = new QLabel(tr("Missing description"), this);
00043 QWhatsThis::add(m_description, tr("Description of the tab's content"));
00044 descLayout->addWidget(m_description);
00045 descLayout->setStretchFactor(m_description, 5);
00046 QPushButton *close = new QPushButton( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
00047 QString::null, this);
00048 close->setFixedSize( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
00049 QWhatsThis::add(close, tr("Close this tab"));
00050 connect(close, SIGNAL(clicked()), this, SLOT(remove()));
00051 descLayout->addWidget(close);
00052 descLayout->setStretchFactor(m_description, 1);
00053 }
00054
00055
00056 void IRCTab::setID(int id) {
00057 m_id = id;
00058 }
00059
00060 int IRCTab::id() {
00061 return m_id;
00062 }
00063
00064 void IRCTab::showEvent( QShowEvent *ev ) {
00065 topLevelWidget()->setCaption( MainWindow::appCaption() + " " + title() );
00066 QWidget::showEvent( ev );
00067 emit editFocus();
00068 }