?? calldialog.cxx
字號:
// mainWidget->removeCallDialog(callId); // Dialog will still exist until close is // clicked - just not receive any SIP commands } if (command.getOp()==SipCommandString::remote_unacceptable){ status.setText("Remote side could not handle the call");// checkRecord.setChecked(false);// checkRecord.setEnabled(false); security_status.setText("Check your authentication settings."); rejectButton.setText("Close");// repaint(); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window);// mainWidget->removeCallDialog(callId); // Dialog will still exist until close is // clicked - just not receive any SIP commands } if (command.getOp()==SipCommandString::remote_reject){ status.setText("Remote side rejected the call");// checkRecord.setChecked(false);// checkRecord.setEnabled(false); security_status.setText(""); rejectButton.setText("Close");// repaint(); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window);// mainWidget->removeCallDialog(callId); // Dialog will still exist until close is // clicked - just not receive any SIP commands } if (command.getOp()==SipCommandString::remote_cancelled_invite){ status.setText("Remote side cancelled the call"); checkRecord.setChecked(false); checkRecord.setEnabled(false); rejectButton.setText("Close"); security_status.setText(""); hideAcceptButton(); /* Stop the bell */ if( bell != NULL ){ bell->stop(); delete bell; bell = NULL; }// repaint(); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window);// mainWidget->removeCallDialog(callId); // Dialog will still exist until close is } if (command.getOp()==SipCommandString::remote_ringing){ status.setText("Ringing...");// checkRecord.setChecked(false);// checkRecord.setEnabled(false); rejectButton.setText("Hang up");// repaint(); } if (command.getOp()==SipCommandString::temp_unavail){ status.setText("The user is reported temporary unavailable"); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window); rejectButton.setText("Close");// repaint(); } if (command.getOp()==SipCommandString::transport_error){ status.setText("The user could not be contacted (transmisison error)"); rejectButton.setText("Close");// repaint(); } if (command.getOp()==SipCommandString::cancel_ok){ status.setText("Call canceled"); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window); rejectButton.setText("Close");// repaint(); } if (command.getOp()==SipCommandString::security_failed){ /*QMessageBox * dialog = new QMessageBox("Switch to insecure call?", "A secured call could not be established.\nThe person you are trying to reach does probably not support\nsecurity. Do you want to go on with an insecured call,\nor cancel the call?", QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton, this); CommandString * resp; if (dialog->exec() == QMessageBox::Ok) resp = new SipCommandString(callId, SipCommandString::accept_insecure); else resp = new CommandString(callId, SipCommandString::reject_insecure); mainWidget->getSipPhone()->enqueueCommand(SipSMCommand(*resp, SipSMCommand::remote, SipSMCommand::TU)); */ status.setText("Security is not handled by the receiver");// status.repaint(); security_status.setText("");// security_status.repaint(); rejectButton.setText( "Close" ); //cancel.repaint(); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window); } if(command.getOp() == SipCommandString::close_window){ rejectClicked(); } return true; } return false;}void CallDialog::keyPressEvent(QKeyEvent * e){ switch(e->key()){ case Key_F12: rejectClicked(); break; default: fprintf(stderr, "%x\n", e->key() ); //e->ignore(); }}RegCallDialog::RegCallDialog(string callid, MinisipMainWindowWidget *mainWidget, TimeoutProvider<string> *tp, string proxy/*, string authenticated*/): CallDialog(callid, mainWidget, tp), userPassLayout(this,3,2), usernameLabel("Username: ",this), usernameEdit(this), passwordLabel("Password: ",this), passwordEdit(this), saveCheck("Save this information", this){ //vlayout.addWidget(&status); status.setText(("Registering to "+proxy+"...").c_str()); //vlayout.addWidget(&security_status); security_status.setText("");// if(authenticated != "")// status.setText(string("(Authenticated Registration)").c_str()); vlayout.insertLayout(2,&userPassLayout); vlayout.insertSpacing(3,25); userPassLayout.addWidget(&usernameLabel, 0, 0); userPassLayout.addWidget(&usernameEdit, 0, 1); userPassLayout.addWidget(&passwordLabel, 1, 0); userPassLayout.addWidget(&passwordEdit, 1, 1); userPassLayout.addWidget(&saveCheck, 2, 0); usernameLabel.hide(); usernameEdit.hide(); passwordLabel.hide(); passwordEdit.hide(); saveCheck.hide(); //vlayout.addWidget(&checkRecord); checkRecord.hide(); //vlayout.addWidget(&cancel); //connect(&cancel,SIGNAL(clicked()), this, SLOT(cancelClicked()) ); //status.setMinimumWidth(250);}void RegCallDialog::rejectClicked(){ if(rejectButton.text() == "Register"){ CommandString reg(getCallId(), SipCommandString::setpassword, usernameEdit.text().ascii(), passwordEdit.text().ascii()); //SipSMCommand cmd(reg, SipSMCommand::remote, SipSMCommand::TU); mainWidget->getCallback()->guicb_handleCommand(/*cmd*/ reg); } CallDialog::rejectClicked(); /*if(cancel.text() == "Close"){ timeoutProvider->cancel_request(this, SipCommandString::close_window); mainWidget->removeCallDialog(callId); done(0); }*/}bool RegCallDialog::handleCommand(CommandString command){ if(command.getDestinationId() != getCallId()){ return false; } if(command.getOp() == SipCommandString::register_sent){ return true; } if(command.getOp() == SipCommandString::register_ok){ status.setText(("Registration to "+command.getParam()+" successful").c_str()); if(saveCheck.isChecked()){ fprintf(stderr, "Saving registration information\n"); XMLFileParser * parser = new XMLFileParser(config->configFileName); parser->changeValue("proxy_username",usernameEdit.text().ascii()); parser->changeValue("proxy_password",passwordEdit.text().ascii()); parser->saveToFile(); delete parser; } usernameLabel.hide(); usernameEdit.hide(); passwordLabel.hide(); passwordEdit.hide(); saveCheck.hide(); rejectButton.setText(string("Close").c_str()); hideAcceptButton();// repaint(); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window); return true; } if(command.getOp() == SipCommandString::close_window){ rejectClicked(); return true; } if(command.getOp() == SipCommandString::register_failed_authentication || command.getOp() == SipCommandString::register_failed){ status.setText(string("Registration to "+command.getParam()+" failed\n"+command.getParam2()).c_str()); //FIXME: ugly ... if (rejectButton.text() == "Cancel" || rejectButton.text() == "Hang up") rejectButton.setText(string("Close").c_str());// repaint(); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window); return true; } if(command.getOp() == SipCommandString::transport_error){ status.setText(string("Registration to <"+command.getParam()+"> failed\n"+command.getParam2()).c_str()); //FIXME: ugly ... if (rejectButton.text() == "Cancel" || rejectButton.text() == "Hang up") rejectButton.setText(string("Close").c_str());// repaint(); timeoutProvider->request_timeout(5000, this, SipCommandString::close_window); return true; } if(command.getOp() == SipCommandString::ask_password){ status.setText(("Please enter registration information\n" "for " + command.getParam()).c_str()); rejectButton.setText("Register"); usernameLabel.show(); usernameEdit.show(); passwordLabel.show(); passwordEdit.show(); saveCheck.show(); return true; } return false; }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -