diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /ksirc/NewWindowDialog.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/NewWindowDialog.cpp')
-rw-r--r-- | ksirc/NewWindowDialog.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/ksirc/NewWindowDialog.cpp b/ksirc/NewWindowDialog.cpp new file mode 100644 index 00000000..c4af16f1 --- /dev/null +++ b/ksirc/NewWindowDialog.cpp @@ -0,0 +1,73 @@ +#include <kapplication.h> +#include <kconfig.h> +#include <klocale.h> +#include <kcombobox.h> +#include <qhbox.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <klineedit.h> +#include "NewWindowDialog.h" + +NewWindowDialog::NewWindowDialog(const KSircChannel &channelInfo, QWidget * parent, const char * name) + : KDialogBase(parent, name, true, i18n("New Window For"), Ok|Cancel, Ok, true), + m_channelInfo(channelInfo) +{ + QHBox * w = makeHBoxMainWidget(); + + QLabel * l = new QLabel(i18n("C&hannel/Nick:"), w); + + m_combo = new KHistoryCombo(w); + m_combo->setFocus(); + + // we don't need duplicated channel into the list + m_combo->setDuplicatesEnabled( false ); + + l->setBuddy(m_combo); + + QLabel * l2 = new QLabel(i18n("&Key:"), w); + m_le = new KLineEdit(w); + m_le->setEnabled(false); + l2->setBuddy(m_le); + + connect( + m_combo, SIGNAL(activated(const QString &)), + m_combo, SLOT(addToHistory(const QString &))); + connect( m_combo->lineEdit(), SIGNAL(textChanged ( const QString & )), + this, SLOT( slotTextChanged( const QString &))); + + KConfig *kConfig = kapp->config(); + KConfigGroupSaver saver(kConfig, "Recent"); + m_combo->setHistoryItems(kConfig->readListEntry("Channels")); + slotTextChanged( m_combo->lineEdit()->text()); +} + +NewWindowDialog::~NewWindowDialog() +{ + KConfig *kConfig = kapp->config(); + KConfigGroupSaver saver(kConfig, "Recent"); + kConfig->writeEntry("Channels", m_combo->historyItems()); +} + +void NewWindowDialog::slotTextChanged( const QString &text) +{ + enableButtonOK( !text.isEmpty() ); + + if(text[0] == "#" || text[0] == "&") + m_le->setEnabled(true); + else + m_le->setEnabled(false); +} + + + void +NewWindowDialog::slotOk() +{ + m_channelInfo.setChannel(m_combo->lineEdit()->text().lower()); + if(m_le->isEnabled()) + m_channelInfo.setKey(m_le->text()); + emit(openTopLevel(m_channelInfo)); + KDialogBase::slotOk(); +} + +#include "NewWindowDialog.moc" + |