#include "clientidentity.h"
#include "network.h"
#include "util.h"
+#include "clientignorelistmanager.h"
+#include "client.h"
NetworkModelController::NetworkModelController(QObject *parent)
: QObject(parent),
if(inactive.count()) {
msg = tr("Do you want to delete the following buffer(s) permanently?", 0, inactive.count());
msg += "<ul>";
- foreach(BufferInfo info, inactive)
- msg += QString("<li>%1</li>").arg(info.bufferName());
+ int count = 0;
+ foreach(BufferInfo info, inactive) {
+ if(count < 10) {
+ msg += QString("<li>%1</li>").arg(info.bufferName());
+ count++;
+ }
+ else
+ break;
+ }
msg += "</ul>";
+ if(count > 9 && inactive.size() - count != 0)
+ msg += tr("...and <b>%1</b> more<br><br>").arg(inactive.size() - count);
msg += tr("<b>Note:</b> This will delete all related data, including all backlog data, from the core's database and cannot be undone.");
if(inactive.count() != indexList.count())
msg += tr("<br>Active channel buffers cannot be deleted, please part the channel first.");
int filter = 0;
if(NetworkModelController::action(HideJoin)->isChecked())
- filter |= Message::Join;
+ filter |= Message::Join | Message::NetsplitJoin;
if(NetworkModelController::action(HidePart)->isChecked())
filter |= Message::Part;
if(NetworkModelController::action(HideQuit)->isChecked())
- filter |= Message::Quit;
+ filter |= Message::Quit | Message::NetsplitQuit;
if(NetworkModelController::action(HideNick)->isChecked())
filter |= Message::Nick;
if(NetworkModelController::action(HideMode)->isChecked())
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;
}
break;
case ShowIgnoreList:
if(networkId.isValid())
- emit showIgnoreList(networkId);
+ emit showIgnoreList(QString());
break;
default:
break;
}
}
-void NetworkModelController::handleNickAction(ActionType type, QAction *) {
+void NetworkModelController::handleNickAction(ActionType type, QAction *action) {
foreach(QModelIndex index, indexList()) {
NetworkId networkId = index.data(NetworkModel::NetworkIdRole).value<NetworkId>();
if(!networkId.isValid())
Client::userInput(bufferInfo, QString("/KICK %1").arg(nick));
break;
case NickSwitchTo:
- Client::bufferModel()->switchToBuffer(findQueryBuffer(networkId, nick));
- break;
case NickQuery:
- Client::userInput(bufferInfo, QString("/QUERY %1").arg(nick));
+ Client::bufferModel()->switchToOrStartQuery(networkId, nick);
+ break;
+ case NickIgnoreUser:
+ {
+ IrcUser *ircUser = qobject_cast<IrcUser *>(index.data(NetworkModel::IrcUserRole).value<QObject *>());
+ if(!ircUser)
+ break;
+ Client::ignoreListManager()->requestAddIgnoreListItem(IgnoreListManager::SenderIgnore,
+ action->property("ignoreRule").toString(),
+ false, IgnoreListManager::SoftStrictness,
+ IgnoreListManager::NetworkScope,
+ ircUser->network()->networkName(), true);
+ break;
+ }
+ case NickIgnoreHost:
+ {
+ IrcUser *ircUser = qobject_cast<IrcUser *>(index.data(NetworkModel::IrcUserRole).value<QObject *>());
+ if(!ircUser)
+ break;
+ Client::ignoreListManager()->requestAddIgnoreListItem(IgnoreListManager::SenderIgnore,
+ action->property("ignoreRule").toString(),
+ false, IgnoreListManager::SoftStrictness,
+ IgnoreListManager::NetworkScope,
+ ircUser->network()->networkName(), true);
+ break;
+ }
+ case NickIgnoreDomain:
+ {
+ IrcUser *ircUser = qobject_cast<IrcUser *>(index.data(NetworkModel::IrcUserRole).value<QObject *>());
+ if(!ircUser)
+ break;
+ Client::ignoreListManager()->requestAddIgnoreListItem(IgnoreListManager::SenderIgnore,
+ action->property("ignoreRule").toString(),
+ false, IgnoreListManager::SoftStrictness,
+ IgnoreListManager::NetworkScope,
+ ircUser->network()->networkName(), true);
+ break;
+ }
+ case NickIgnoreCustom:
+ // forward that to mainwin since we can access the settingspage only from there
+ emit showIgnoreList(action->property("ignoreRule").toString());
+ break;
+ case NickIgnoreToggleEnabled0:
+ case NickIgnoreToggleEnabled1:
+ case NickIgnoreToggleEnabled2:
+ case NickIgnoreToggleEnabled3:
+ case NickIgnoreToggleEnabled4:
+ Client::ignoreListManager()->requestToggleIgnoreRule(action->property("ignoreRule").toString());
break;
default:
qWarning() << "Unhandled nick action";
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()));
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());
}