int Asterisk_CallerID_Monitor::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: incoming_call((*reinterpret_cast< QString(*)>(_a[1]))); break; case 1: check_status(); break; case 2: asterisk_response(); break; default: ; } _id -= 3; } return _id; }
static void ring_callback (plugin_t *p, DBusMessage *msg, void *data) { at_modem_t *m = data; DBusMessageIter call; /* Skip call object path */ if (!dbus_message_iter_init (msg, &call) || dbus_message_iter_get_arg_type (&call) != DBUS_TYPE_OBJECT_PATH) return; dbus_message_iter_next (&call); /* Only care about incoming or waiting calls */ const char *str = ofono_dict_find_string (&call, "State"); if (str == NULL) return; if (!strcmp (str, "incoming")) incoming_call (p, &call, m); if (!strcmp (str, "waiting")) waiting_call (p, &call, m); }
static void accept_new(void) { char buffer[MAX_ATM_ADDR_LEN+1]; struct sockaddr_atmsvc addr; struct atm_qos qos; ENTRY *entry; VCC *vcc; int fd,error; socklen_t len,size; len = sizeof(addr); if ((fd = accept(incoming,(struct sockaddr *) &addr,&len)) < 0) { error = errno; diag(COMPONENT,DIAG_ERROR,"accept: %s",strerror(errno)); if (error == EUNATCH) { diag(COMPONENT,DIAG_WARN,"disabling SVCs"); (void) close(incoming); incoming = -1; } return; } /* the following code probably belongs to arp.c ... */ if (atm2text(buffer,MAX_ATM_ADDR_LEN+1,(struct sockaddr *) &addr,pretty) < 0) strcpy(buffer,"<atm2text error>"); diag(COMPONENT,DIAG_DEBUG,"Incoming call from %s",buffer); size = sizeof(qos); if (getsockopt(fd,SOL_ATM,SO_ATMQOS,&qos,&size) < 0) diag(COMPONENT,DIAG_FATAL,"getsockopt SO_ATMQOS: %s",strerror(errno)); if (size != sizeof(qos)) diag(COMPONENT,DIAG_FATAL,"SO_ATMQOS: size %d != %d",size,sizeof(qos)); if (ioctl(fd,ATMARP_MKIP,qos.txtp.traffic_class == ATM_NONE ? 0 : CLIP_DEFAULT_IDLETIMER) < 0) { diag(COMPONENT,DIAG_ERROR,"ioctl ATMARP_MKIP: %s",strerror(errno)); (void) do_close(fd); return; } vcc = alloc_t(VCC); vcc->active = 0; vcc->connecting = 0; vcc->fd = fd; if (qos.txtp.traffic_class == ATM_NONE) { vcc->entry = NULL; incoming_unidirectional(vcc); Q_INSERT_HEAD(unidirectional_vccs,vcc); return; } if (merge) { ITF *itf; for (itf = itfs; itf; itf = itf->next) { entry = lookup_addr(itf,&addr); if (entry) { vcc->entry = entry; Q_INSERT_HEAD(entry->vccs,vcc); if (entry->state == as_valid) { if (set_ip(vcc->fd,entry->ip) < 0) { diag(COMPONENT,DIAG_ERROR,"set_ip: %s", strerror(errno)); disconnect_vcc(vcc); } else set_sndbuf(vcc); } return; } } } entry = alloc_entry(1); entry->state = as_invalid; entry->addr = alloc_t(struct sockaddr_atmsvc); *entry->addr = addr; entry->flags = ATF_PUBL; Q_INSERT_HEAD(unknown_incoming,entry); vcc->entry = entry; Q_INSERT_HEAD(entry->vccs,vcc); incoming_call(vcc); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->tracking_status=FALSE; QIcon* icon =new QIcon((QString)APATH+"clock.png"); ui->pushHour->setEnabled(FALSE); ui->pushHour->setIcon(*icon); ui->pushHour->setIconSize(QSize( ui->pushHour->size().width()-5,ui->pushHour->size().height()-5 )); QIcon* icon1 =new QIcon((QString)APATH+"add.png"); ui->pushAddEarlier->setIcon(*icon1); ui->pushAddEarlier->setIconSize(QSize( ui->pushAddEarlier->size().width()-5,ui->pushAddEarlier->size().height()-5 )); QIcon* icon3 =new QIcon((QString)APATH+"delete.png"); ui->pushDelete->setIcon(*icon3); ui->pushDelete->setIconSize(QSize( ui->pushDelete->size().width()-5,ui->pushDelete->size().height()-5 )); ui->pushDelete->setFocusPolicy(Qt::NoFocus); ui->pushAddEarlier->setFocusPolicy(Qt::NoFocus); ui->pushDelete->setEnabled(FALSE); QIcon* icon2 =new QIcon((QString)APATH+"hourglass.png"); this->setWindowIcon(*icon2); db1=QSqlDatabase::addDatabase("QMYSQL","hourglass"); db1.setDatabaseName("hourglass"); db1.setHostName(g_HOST); db1.setUserName(g_USER); db1.setPassword(g_PASS); db1=QSqlDatabase::database("hourglass"); // QPluginLoader *thePlugin = new QPluginLoader("/home/jim/qt/qt-4.6.3/plugins/sqldrivers/libqsqlmysql.so"); //qDebug() << thePlugin->load(); //qDebug() << thePlugin->isLoaded(); //qDebug() << thePlugin->errorString(); if (!db1.open()) { qDebug()<<"Απέτυχε η σύνδεση με τη βάση"; exit(0); } db2=QSqlDatabase::addDatabase("QMYSQL","asterisk"); db2.setDatabaseName("asterisk"); db2.setHostName(g_ASTERISK_SERVER); db2.setUserName(g_AST_MYSQL_USER); db2.setPassword(g_AST_MYSQL_PASS); db2=QSqlDatabase::database("asterisk"); if (!db2.open()) { qDebug()<<"Απέτυχε η σύνδεση με τη βάση"; //exit(0); } this->customer_model=new QSqlQueryModel(); this->project_model=new QSqlQueryModel(); this->places_model=new QSqlQueryModel(); this->tasks_model=new QSqlQueryModel(); this->tasks_full_model=new QSqlQueryModel(); this->daily_calls_model=new QSqlQueryModel(); this->full_calls_model=new QSqlQueryModel(); refresh_customers(); refresh_tasks(); refresh_full_tasks(); refresh_daily_calls(); refresh_full_calls(); this->timer=new QTimer; this->timer_asterisk=new QTimer; timer_asterisk->start(60000); QStringList sl; ui->comboGraph->insertItem(0,trUtf8("ΕΒΔΟΜΑΔΑ")); ui->comboGraph->insertItem(1,trUtf8("ΕΤΟΣ")); ui->comboGraph->insertItem(2,trUtf8("ΔΙΑΧΡΟΝΙΚΟ")); /* QDate simera; simera=QDate::currentDate(); int dayno=simera.dayOfWeek(); QList <int> minut; for (int i=0;i<dayno;++i) { QSqlQuery query(db1); query.exec("select sum(TIMESTAMPDIFF(MINUTE,t.start_time,t.end_time)) from tasks t where date(start_time)='"+simera.addDays(-i).toString("yy/M/d")+"'"); query.next(); minut.prepend(query.value(0).toInt()); qDebug()<<"MINUT:"<<minut; } WeekGraph *drb=new WeekGraph(this); drb->set_list(minut); drb->setFixedWidth(921); drb->setFixedHeight(181); drb->repaint(); */ drb=new WeekGraph(this); drb->setGeometry(180,10,611,151); //drb->setFixedWidth(621); //drb->setFixedHeight(161); connect(timer_asterisk,SIGNAL(timeout()),this,SLOT(refresh_calls())); connect(timer, SIGNAL(timeout()),this, SLOT(refresh_time())); connect(ui->action,SIGNAL(triggered()),this,SLOT(new_customer())); connect(ui->tableCustomers,SIGNAL(clicked(QModelIndex)),this,SLOT(customer_selection_changed())); connect(ui->tableCustomers,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(edit_customer())); connect(ui->pushHour,SIGNAL(released()),this,SLOT(tracking_pressed())); connect(ui->textEdit,SIGNAL(textChanged()),this,SLOT(remove_invalid_chars())); connect(ui->tableView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(edit_task())); connect(ui->tableView_2,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(edit_task_full())); connect(ui->pushAddEarlier,SIGNAL(released()),this,SLOT(add_earlier_task())); connect(ui->actionMigration,SIGNAL(triggered()),this,SLOT(do_migration())); connect(ui->action_2,SIGNAL(triggered()),this,SLOT(invoicing())); connect(ui->actionEmail,SIGNAL(triggered()),this,SLOT(email_tasks())); connect(ui->comboGraph,SIGNAL(currentIndexChanged(int)),this,SLOT(change_graph(int))); connect(ui->actionProjects,SIGNAL(triggered()),this,SLOT(projects())); connect(ui->actionReview,SIGNAL(triggered()),this,SLOT(invoice_review())); connect(ui->tableView,SIGNAL(clicked(QModelIndex)),this,SLOT(table_clicked())); connect(ui->tableView_2,SIGNAL(clicked(QModelIndex)),this,SLOT(table2_clicked())); connect(ui->pushDelete,SIGNAL(released()),this,SLOT(delete_clicked())); connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(tab_changed(int))); ui->comboGraph->setCurrentIndex(-1); ui->comboGraph->setCurrentIndex(0); ui->tableView->setContextMenuPolicy(Qt::CustomContextMenu); ui->tableTodayCalls->setContextMenuPolicy(Qt::CustomContextMenu); ui->tableAllCalls->setContextMenuPolicy(Qt::CustomContextMenu); ui->tableCustomers->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->tableView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(context_menu(const QPoint&))); connect(ui->tableView_2->horizontalHeader(),SIGNAL(sectionClicked(int)),this,SLOT(sortbycolumn(int))); connect(ui->tableCustomers,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(dial_customer(const QPoint&))); connect(ui->tableTodayCalls,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(context_menu_daily_calls(QPoint))); connect(ui->tableAllCalls,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(context_menu_full_calls(QPoint))); Asterisk_CallerID_Monitor *ast_monitor=new Asterisk_CallerID_Monitor(this); connect (ast_monitor,SIGNAL(incoming_call(QString)),this,SLOT(incoming_call(QString))); ast_monitor->start_monitor(); }