📄 phonectrlcenter.cpp
字号:
/*************************************************************************** phonectrlcenter.cpp - description ------------------- begin : Wed Jan 17 2001 copyright : (C) 2001 by Matthias Welwarsky email : matze@stud.fbi.fh-darmstadt.de ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include <kdebug.h>#include <klocale.h>#include <kmessagebox.h>#include <qpushbutton.h>#include "phoneconnection.h"#include "phonectrlcontainer.h"#include "phonectrlcenter.h"#include "messagedispatcher.h"// include phone control object declarations#include "phonecontrol.h"#include "phonestatuscontrol.h"#include "phonebookcontrol.h"#include "phonesmscontrol.h"#include "phonetransferlogo.h"#include "phoneterminal.h"PhoneCtrlCenter::PhoneCtrlCenter(QWidget *parent, const char *name ) : PhoneCtrlCenterDlg(parent,name) { phoneConnection = new PhoneConnection; messageDispatcher = new MessageDispatcher(phoneConnection); isConnected = false; initControls();}PhoneCtrlCenter::~PhoneCtrlCenter(){ delete phoneConnection;}/** called by the button group, contains the number of the button that was clicked */void PhoneCtrlCenter::slotFunctionSelected(int id){ kdDebug() << "FunctionSelected " << id << endl; switch (id) { case 0: if (!isConnected) { if (!phoneConnection->openConnection()) { KMessageBox::error(this, phoneConnection->errorMessage()); return; } connectButton->setText(i18n("Disconnect")); phonebookButton->setEnabled(TRUE); phoneStatusButton->setEnabled(TRUE); sendMessageButton->setEnabled(TRUE); transferLogoButton->setEnabled(TRUE); terminalButton->setEnabled(TRUE); isConnected = true; } else { // disable the active control if (phoneCtrlContainer->activeControl()) { phoneCtrlContainer->activeControl()->stopControl(); } //close the connection phoneConnection->closeConnection(); connectButton->setText(i18n("Connect")); // disable all buttons phonebookButton->setEnabled(FALSE); phoneStatusButton->setEnabled(FALSE); sendMessageButton->setEnabled(FALSE); transferLogoButton->setEnabled(FALSE); terminalButton->setEnabled(FALSE); isConnected = false; } break; case 6: break; default: if (phoneCtrlContainer->activeControl()) { phoneCtrlContainer->activeControl()->stopControl(); } phoneCtrlContainer->setControl(id); phoneCtrlContainer->activeControl()->startControl(); break; }}/** initialises the phone control widgets */void PhoneCtrlCenter::initControls(){ phoneCtrlContainer->addControl(new PhoneStatusControl(this), 1); phoneCtrlContainer->addControl(new PhoneBookControl(this), 2); phoneCtrlContainer->addControl(new PhoneSMSControl(this), 3); phoneCtrlContainer->addControl(new PhoneTransferLogo(this), 4); phoneCtrlContainer->addControl(new PhoneTerminal(this), 5);}/** returns a pointer to the current message dispatcher object, or NULL if there is none. */MessageDispatcher* PhoneCtrlCenter::getDispatcher() const { return messageDispatcher;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -