- QAction *result = contextMenu.exec(QCursor::pos());
- if(result == connectNetAction || result == disconnectNetAction) {
- const Network *network = Client::network(index.data(NetworkModel::NetworkIdRole).value<NetworkId>());
- if(!network) return;
- if(network->connectionState() == Network::Disconnected)
- network->requestConnect();
- else
- network->requestDisconnect();
- } else
- if(result == joinChannelAction) {
- // FIXME no QInputDialog in Qtopia
-#ifndef Q_WS_QWS
- bool ok;
- QString channelName = QInputDialog::getText(this, tr("Join Channel"),
- tr("Input channel name:"),QLineEdit::Normal,
- QDir::home().dirName(), &ok);
-
- if (ok && !channelName.isEmpty()) {
- BufferInfo bufferInfo = index.child(0,0).data(NetworkModel::BufferInfoRole).value<BufferInfo>();
- if(bufferInfo.isValid()) {
- Client::instance()->userInput(bufferInfo, QString("/J %1").arg(channelName));
- }
- }
-#endif
- } else if(result == joinBufferAction) {
- Client::instance()->userInput(bufferInfo, QString("/JOIN %1").arg(channelname));
- } else if(result == partBufferAction) {
- Client::instance()->userInput(bufferInfo, QString("/PART %1").arg(channelname));
- } else if(result == hideBufferAction) {
- removeSelectedBuffers();
- } else if(result == removeBufferAction) {
- int res = QMessageBox::question(this, tr("Remove buffer permanently?"),
- tr("Do you want to delete the buffer \"%1\" permanently? This will delete all related data, including all backlog "
- "data, from the core's database!").arg(bufferInfo.bufferName()),
- QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
- if(res == QMessageBox::Yes) {
- Client::removeBuffer(bufferInfo.bufferId());
- }
- } else
- if(result == whoBufferAction) {
- Client::instance()->userInput(bufferInfo, QString("/WHO %1").arg(channelname));
+void BufferView::menuActionTriggered(QAction *result) {
+ NetworkModelActionProvider::ActionType type = (NetworkModelActionProvider::ActionType)result->data().toInt();
+ switch(type) {
+ case NetworkModelActionProvider::HideBufferTemporarily:
+ removeSelectedBuffers();
+ break;
+ case NetworkModelActionProvider::HideBufferPermanently:
+ removeSelectedBuffers(true);
+ break;
+ default:
+ return;