From: Johannes Huber Date: Tue, 2 Mar 2010 02:18:00 +0000 (+0100) Subject: added pwd input to join channel dlg X-Git-Tag: 0.6-rc1~15 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=846375c0a783fa99c0780a0d701ccb21e0bffd61 added pwd input to join channel dlg --- diff --git a/src/uisupport/networkmodelcontroller.cpp b/src/uisupport/networkmodelcontroller.cpp index be1db922..75e6e8ef 100644 --- a/src/uisupport/networkmodelcontroller.cpp +++ b/src/uisupport/networkmodelcontroller.cpp @@ -329,15 +329,20 @@ void NetworkModelController::handleGeneralAction(ActionType type, QAction *actio switch(type) { case JoinChannel: { QString channelName = contextItem(); + QString channelPassword; if(channelName.isEmpty()) { JoinDlg dlg(indexList().first()); if(dlg.exec() == QDialog::Accepted) { channelName = dlg.channelName(); networkId = dlg.networkId(); + channelPassword = dlg.channelPassword(); } } if(!channelName.isEmpty()) { - Client::instance()->userInput(BufferInfo::fakeStatusBuffer(networkId), QString("/JOIN %1").arg(channelName)); + if(!channelPassword.isEmpty()) + Client::instance()->userInput(BufferInfo::fakeStatusBuffer(networkId), QString("/JOIN %1 %2").arg(channelName).arg(channelPassword)); + else + Client::instance()->userInput(BufferInfo::fakeStatusBuffer(networkId), QString("/JOIN %1").arg(channelName)); } break; } @@ -474,12 +479,15 @@ NetworkModelController::JoinDlg::JoinDlg(const QModelIndex &index, QWidget *pare layout->addWidget(networks = new QComboBox, 0, 1); layout->addWidget(new QLabel(tr("Channel:")), 1, 0); layout->addWidget(channel = new QLineEdit, 1, 1); - layout->addWidget(buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel), 2, 0, 1, 2); + layout->addWidget(new QLabel(tr("Password:")), 2, 0); + layout->addWidget(password = new QLineEdit, 2, 1); + layout->addWidget(buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel), 3, 0, 1, 2); setLayout(layout); channel->setFocus(); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); networks->setInsertPolicy(QComboBox::InsertAlphabetically); + password->setEchoMode(QLineEdit::Password); connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); @@ -511,6 +519,10 @@ QString NetworkModelController::JoinDlg::channelName() const { return channel->text(); } +QString NetworkModelController::JoinDlg::channelPassword() const { + return password->text(); +} + void NetworkModelController::JoinDlg::on_channel_textChanged(const QString &text) { buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty()); } diff --git a/src/uisupport/networkmodelcontroller.h b/src/uisupport/networkmodelcontroller.h index 268e783a..8782187d 100644 --- a/src/uisupport/networkmodelcontroller.h +++ b/src/uisupport/networkmodelcontroller.h @@ -177,6 +177,7 @@ public: JoinDlg(const QModelIndex &index, QWidget *parent = 0); QString channelName() const; + QString channelPassword() const; NetworkId networkId() const; private slots: @@ -185,6 +186,7 @@ private slots: private: QComboBox *networks; QLineEdit *channel; + QLineEdit *password; QDialogButtonBox *buttonBox; };