void SMSClient::setStatus(unsigned status) { if (status == STATUS_OFFLINE){ Contact *contact; ContactList::ContactIterator it; while ((contact = ++it) != NULL) contact->clientData.freeClientData(this); if (m_ta){ delete m_ta; m_ta = NULL; } return; } if (m_ta) return; m_ta = new GsmTA(this); connect(m_ta, SIGNAL(init_done()), this, SLOT(init())); connect(m_ta, SIGNAL(error()), this, SLOT(error())); connect(m_ta, SIGNAL(phonebookEntry(int, int, const QString&, const QString&)), this, SLOT(phonebookEntry(int, int, const QString&, const QString&))); connect(m_ta, SIGNAL(charge(bool, unsigned)), this, SLOT(charge(bool, unsigned))); connect(m_ta, SIGNAL(quality(unsigned)), this, SLOT(quality(unsigned))); connect(m_ta, SIGNAL(phoneCall(const QString&)), this, SLOT(phoneCall(const QString&))); if (!m_ta->open(getDevice(), getBaudRate(), getXonXoff())){ error_state("Can't open port", 0); return; } }
void dController::parseCnvThread(int Code,QString output ) { QString msg; if (Code != QProcess::NormalExit) { msg =QObject::trUtf8("Ошибка предпечатной подготовки.\n%1:\nКод %2").arg(output).arg(Code,0,10); emit error(Code,msg); }else{ // Файл преобразован в pdf QString msg= QObject::trUtf8("Исходный файл успешно конвертирован в pdf"); emit init_done(CONVERT_STEP,msg); qDebug() << QObject::tr("Успешно завершена конвертация исходного файла в pdf."); } }
void dController::readServerResponce(QString &line) { QRegExp rx("^/(\\d+);:;(.+)$"); QString msg; QString cmd; QString body; if(rx.indexIn(line) != -1) { cmd =rx.cap(1); body = rx.cap(2); qDebug() <<Q_FUNC_INFO<< cmd<<body; switch (cmd.toInt()){ case STAMP_LIST_ANS: this->stampModel->setStringList(QStringList() << body.split(";:;")); break; case REGISTER_ANS: // Соединились с сервером безопастности msg= QObject::trUtf8("Успешно соединились с сервером безопастности"); emit init_done(CONN_STEP,msg); this->getStampName(); // Получим с сервера название уровней безопастности this->getPrinterCount(); break; case MB_EXIST_AND_BRAK_ANS: this->insertDocToModel(body); emit mbNumberExist(doc_model->rowCount()); break; case MB_EXIST_AND_NOT_BRAK_ANS: emit mbNumberExist(DOC_PRINTED); break; case MB_NOT_EXIST_ANS: emit mbNumberNotExist(); break; case PRINTER_LIST_EMPTY: emit printersNotFound(); break; } }else{ // emit error } }
//---------------------------------------- Private SLOTS -------------------------------------------------------------------- void dController::done_ftp_transfer() { QString msg= QObject::trUtf8("Успешно полученны глобальные шаблоны."); init_done(GET_FROM_FTP_STEP,msg); }
int main(int argc, const char *argv[]) { int opt; poptContext pc; int opt_daemon = 0; int opt_interactive = 0; int opt_version = 0; char *opt_config_file = NULL; int opt_debug = 0; verto_ctx *vctx; verto_ev *ev; int vflags; struct gssproxy_ctx *gpctx; struct gp_sock_ctx *sock_ctx; int wait_fd; int ret; int i; struct poptOption long_options[] = { POPT_AUTOHELP {"daemon", 'D', POPT_ARG_NONE, &opt_daemon, 0, \ _("Become a daemon (default)"), NULL }, \ {"interactive", 'i', POPT_ARG_NONE, &opt_interactive, 0, \ _("Run interactive (not a daemon)"), NULL}, \ {"config", 'c', POPT_ARG_STRING, &opt_config_file, 0, \ _("Specify a non-default config file"), NULL}, \ {"debug", 'd', POPT_ARG_NONE, &opt_debug, 0, \ _("Enable debugging"), NULL}, \ {"version", '\0', POPT_ARG_NONE, &opt_version, 0, \ _("Print version number and exit"), NULL }, \ POPT_TABLEEND }; pc = poptGetContext(argv[0], argc, argv, long_options, 0); while((opt = poptGetNextOpt(pc)) != -1) { switch(opt) { default: fprintf(stderr, "\nInvalid option %s: %s\n\n", poptBadOption(pc, 0), poptStrerror(opt)); poptPrintUsage(pc, stderr, 0); return 1; } } if (opt_version) { puts(VERSION""DISTRO_VERSION""PRERELEASE_VERSION); return 0; } if (opt_debug) { gp_debug_enable(); } if (opt_daemon && opt_interactive) { fprintf(stderr, "Option -i|--interactive is not allowed together with -D|--daemon\n"); poptPrintUsage(pc, stderr, 0); return 1; } if (opt_interactive) { opt_daemon = 2; } gpctx = calloc(1, sizeof(struct gssproxy_ctx)); gpctx->config = read_config(opt_config_file, opt_daemon); if (!gpctx->config) { exit(EXIT_FAILURE); } init_server(gpctx->config->daemonize, &wait_fd); write_pid(); vctx = init_event_loop(); if (!vctx) { fprintf(stderr, "Failed to initialize event loop. " "Is there at least one libverto backend installed?\n"); return 1; } gpctx->vctx = vctx; /* init main socket */ sock_ctx = init_unix_socket(gpctx, gpctx->config->socket_name); if (!sock_ctx) { return 1; } vflags = VERTO_EV_FLAG_PERSIST | VERTO_EV_FLAG_IO_READ; ev = verto_add_io(vctx, vflags, accept_sock_conn, sock_ctx->fd); if (!ev) { return 1; } verto_set_private(ev, sock_ctx, NULL); /* init secondary sockets */ for (i = 0; i < gpctx->config->num_svcs; i++) { if (gpctx->config->svcs[i]->socket != NULL) { sock_ctx = init_unix_socket(gpctx, gpctx->config->svcs[i]->socket); if (!sock_ctx) { return 1; } vflags = VERTO_EV_FLAG_PERSIST | VERTO_EV_FLAG_IO_READ; ev = verto_add_io(vctx, vflags, accept_sock_conn, sock_ctx->fd); if (!ev) { return 1; } verto_set_private(ev, sock_ctx, NULL); } } /* We need to tell nfsd that GSS-Proxy is available before it starts, * as nfsd needs to know GSS-Proxy is in use before the first time it * needs to call accept_sec_context. */ init_proc_nfsd(gpctx->config); /* Now it is safe to tell the init system that we're done starting up, * so it can continue with dependencies and start nfsd */ init_done(wait_fd); ret = drop_privs(gpctx->config); if (ret) { exit(EXIT_FAILURE); } ret = gp_workers_init(gpctx); if (ret) { exit(EXIT_FAILURE); } verto_run(vctx); gp_workers_free(gpctx->workers); fini_server(); poptFreeContext(pc); free_config(&gpctx->config); return 0; }