From 6b7ee4a7b06b331bd2ce1c110a66677416db7478 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Fri, 4 Jul 2008 17:15:34 +0000 Subject: fixed ticket #132 and backported(frontported?) fix for #27 from version 3.4 git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1994 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/channelsjoin/channelsjoinwindow.cpp | 36 +++++++++++++++++++++---- src/modules/channelsjoin/channelsjoinwindow.h | 2 ++ 2 files changed, 33 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/src/modules/channelsjoin/channelsjoinwindow.cpp b/src/modules/channelsjoin/channelsjoinwindow.cpp index 75bacd393..548b94011 100644 --- a/src/modules/channelsjoin/channelsjoinwindow.cpp +++ b/src/modules/channelsjoin/channelsjoinwindow.cpp @@ -91,13 +91,19 @@ KviChannelsJoinWindow::KviChannelsJoinWindow(QWidget * par, const char * name) g->addWidget(m_pGroupBox,1,0,1,2); // g->addMultiCellWidget(m_pGroupBox,1,1,0,1); - m_pJoinButton = new QPushButton(__tr2qs("&Join"),this); + KviTalHBox * hb = new KviTalHBox(this); + hb->setSpacing(4); + + g->addWidget(hb,2,0,1,2,Qt::AlignHCenter); + + m_pJoinButton = new QPushButton(__tr2qs("&Join"),hb); // Join on return pressed m_pJoinButton->setDefault(true); connect(m_pJoinButton,SIGNAL(clicked()),this,SLOT(joinClicked())); -g->addWidget(m_pJoinButton,2,0,1,2,Qt::AlignHCenter); -// g->addMultiCellWidget(m_pJoinButton,2,2,0,1,Qt::AlignHCenter); + m_pRegButton = new QPushButton(__tr2qs("&Register"),hb); + // Join on return pressed + connect(m_pRegButton,SIGNAL(clicked()),this,SLOT(regClicked())); m_pShowAtStartupCheck = new QCheckBox(__tr2qs("Show this window after connecting"),this); m_pShowAtStartupCheck->setChecked(KVI_OPTION_BOOL(KviOption_boolShowChannelsJoinOnIrc)); @@ -172,7 +178,6 @@ void KviChannelsJoinWindow::fillListView() } } - // FIXME: Registered channels go here! par = new KviTalTreeWidgetItem(m_pListView,__tr2qs("Registered Channels")); par->setExpanded(true); @@ -220,9 +225,13 @@ void KviChannelsJoinWindow::enableJoin() if(c) { if(tmp.isEmpty()) + { m_pJoinButton->setEnabled(false); - else + m_pRegButton->setEnabled(false); + } else { m_pJoinButton->setEnabled(true); + m_pRegButton->setEnabled(true); + } } else { m_pListView->setEnabled(false); m_pGroupBox->setEnabled(false); @@ -254,6 +263,23 @@ void KviChannelsJoinWindow::joinClicked() m_pPass->setText(""); } +void KviChannelsJoinWindow::regClicked() +{ + KviStr tmp = m_pChannelEdit->text(); + QList index; + + if(tmp.isEmpty())return; + + KviStr command(KviStr::Format,"regchan.add %s",tmp.ptr()); + + KviConsole * c = g_pApp->topmostConnectedConsole(); + if(!c)return; // no connection + KviWindow * w = g_pActiveWindow; + if(w->console() != c)w = c; + KviKvsScript::run(command.ptr(),w); + fillListView(); +} + /* void KviChannelsJoinWindow::whoClicked() { diff --git a/src/modules/channelsjoin/channelsjoinwindow.h b/src/modules/channelsjoin/channelsjoinwindow.h index c99d8eba3..faeba523f 100644 --- a/src/modules/channelsjoin/channelsjoinwindow.h +++ b/src/modules/channelsjoin/channelsjoinwindow.h @@ -50,6 +50,7 @@ protected: QCheckBox * m_pShowAtStartupCheck; QCheckBox * m_pCloseAfterJoinCheck; QPushButton * m_pJoinButton; + QPushButton * m_pRegButton; KviConsole * m_pConsole; public: virtual void closeEvent(QCloseEvent *e); @@ -63,6 +64,7 @@ protected slots: void editReturnPressed(); void cancelClicked(); void joinClicked(); + void regClicked(); // void whoClicked(); // void namesClicked(); }; -- cgit v1.3.1-10-gc9f91