diff --git a/sflphone-client-kde/src/AccountListModel.cpp b/sflphone-client-kde/src/AccountListModel.cpp index 7dcb09a39c246584527fed46d328fe9f78eaf9bb..3b83ffe11e1053895acc4094423b5bf504d4a84c 100644 --- a/sflphone-client-kde/src/AccountListModel.cpp +++ b/sflphone-client-kde/src/AccountListModel.cpp @@ -127,7 +127,7 @@ bool AccountListModel::addAccount( QString alias ) return true; } -int AccountListModel::rowCount(const QModelIndex & parent) const +int AccountListModel::rowCount(const QModelIndex & /*parent*/) const { return accounts->size(); } diff --git a/sflphone-client-kde/src/AccountWizard.cpp b/sflphone-client-kde/src/AccountWizard.cpp index 0b81f3c15a780a643c25dee34ee4f43787873d7e..27a6b5a444162172ca52443983fde79545d0466f 100644 --- a/sflphone-client-kde/src/AccountWizard.cpp +++ b/sflphone-client-kde/src/AccountWizard.cpp @@ -56,13 +56,13 @@ ***************************************************************************/ typedef struct { - char success; - char reason[200]; - char user[200]; - char passwd[200]; + bool success; + QString reason; + QString user; + QString passwd; } rest_account; -int req(char *host, int port, char *req, char *ret) { +int sendRequest(QString host, int port, QString req, QString & ret) { int s; struct sockaddr_in servSockAddr; @@ -74,9 +74,9 @@ int req(char *host, int port, char *req, char *ret) { char buf[1024]; bzero(&servSockAddr, sizeof(servSockAddr)); - servHostEnt = gethostbyname(host); + servHostEnt = gethostbyname(host.toLatin1()); if (servHostEnt == NULL) { - strcpy(ret, "gethostbyname"); + ret = "gethostbyname"; return -1; } bcopy((char *)servHostEnt->h_addr, (char *)&servSockAddr.sin_addr, servHostEnt->h_length); @@ -84,20 +84,22 @@ int req(char *host, int port, char *req, char *ret) { servSockAddr.sin_family = AF_INET; if ((s = socket(AF_INET,SOCK_STREAM,0)) < 0) { - strcpy(ret, "socket"); + ret = "socket"; return -1; } if(connect(s, (const struct sockaddr *) &servSockAddr, (socklen_t) sizeof(servSockAddr)) < 0 ) { - perror("foo"); - strcpy(ret, "connect"); + perror(NULL); + ret = "connect"; return -1; } f = fdopen(s, "r+"); - fprintf(f, "%s HTTP/1.1\r\n", req); - fprintf(f, "Host: %s\r\n", host); + const char * req2 = req.toLatin1(); + const char * host2 = host.toLatin1(); + fprintf(f, "%s HTTP/1.1\r\n", req2); + fprintf(f, "Host: %s\r\n", host2); fputs("User-Agent: SFLphone\r\n", f); fputs("\r\n", f); @@ -113,7 +115,8 @@ int req(char *host, int port, char *req, char *ret) { ret[i] = fgetc(f); if (status != 200) { - sprintf(ret, "http error: %ld", status); + ret = "http error: " + status; +// sprintf(ret, "http error: %ld", status); return -1; } @@ -123,22 +126,22 @@ int req(char *host, int port, char *req, char *ret) { return 0; } -rest_account get_rest_account(char *host,char *email) { - char ret[4096]; +rest_account get_rest_account(QString host, QString email) { + QString req = "GET /rest/accountcreator?email=" + email; + QString ret; rest_account ra; - bzero(ret, sizeof(ret)); - printf("HOST: %s\n", host); - strcpy(ret,"GET /rest/accountcreator?email="); - strcat(ret, email); - if (req(host, 80, ret, ret) != -1) { - strcpy(ra.user, strtok(ret, "\n")); - strcpy(ra.passwd, strtok(NULL, "\n"));\ - ra.success = 1; + qDebug() << "HOST: " << host; + int res = sendRequest(host, 80, req, ret); + if (res != -1) { + QStringList list = ret.split("\n"); + ra.user = list[0]; + ra.passwd = list[1];\ + ra.success = true; } else { - ra.success = 0; - strcpy(ra.reason, ret); + ra.success = false; + ra.reason = ret; } - puts(ret); + qDebug() << ret; return ra; } diff --git a/sflphone-client-kde/src/CodecListModel.cpp b/sflphone-client-kde/src/CodecListModel.cpp index 4acf8a05662df40dc63f3ac612ac74a21952db4f..31b694e64a916f3e0fcd358f4b5a6fa1471d16d7 100644 --- a/sflphone-client-kde/src/CodecListModel.cpp +++ b/sflphone-client-kde/src/CodecListModel.cpp @@ -71,12 +71,12 @@ QVariant CodecListModel::data ( const QModelIndex & index, int role) const } -int CodecListModel::rowCount(const QModelIndex & parent) const +int CodecListModel::rowCount(const QModelIndex & /*parent*/) const { return codecs.count(); } -int CodecListModel::columnCount(const QModelIndex & parent) const +int CodecListModel::columnCount(const QModelIndex & /*parent*/) const { return 4; } diff --git a/sflphone-client-kde/src/Item.h b/sflphone-client-kde/src/Item.h index c859375c07cfbabc6091b52b67b13745106e99e9..ed1063d6bac0e2203ca01581c7490808e2068d11 100644 --- a/sflphone-client-kde/src/Item.h +++ b/sflphone-client-kde/src/Item.h @@ -43,7 +43,12 @@ protected: public: - Item(QListWidget *list=0) + /** + * Would be great to take the QListWidget as attribute + * to be able to add the itemWidget to the item in the list. + * For the moment, we have to do it from outside. + */ + Item(/*QListWidget *list=0*/) { item = NULL; itemWidget = NULL; @@ -63,6 +68,7 @@ public: { return item; } + WIDGET_TYPE * getItemWidget() { return itemWidget; diff --git a/sflphone-client-kde/src/main.cpp b/sflphone-client-kde/src/main.cpp index 2096d1fc7672fa96a02ff3928930e9df773c8b5e..6be5f8995986a16c2f120e4976b92eb5ec93d4a7 100644 --- a/sflphone-client-kde/src/main.cpp +++ b/sflphone-client-kde/src/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char **argv) //configuration dbus registerCommTypes(); - SFLPhone * fenetre = new SFLPhone(); + new SFLPhone(); InstanceInterface & instance = InstanceInterfaceSingleton::getInstance(); instance.Register(getpid(), APP_NAME); diff --git a/sflphone-client-kde/src/sflphone_kdeview.cpp b/sflphone-client-kde/src/sflphone_kdeview.cpp index f0f2518a7a8f14a2c8261b0252c44cde1da2a4cc..8099ad4adff4c2e16934f3f8ac7934eda709debc 100644 --- a/sflphone-client-kde/src/sflphone_kdeview.cpp +++ b/sflphone-client-kde/src/sflphone_kdeview.cpp @@ -1343,10 +1343,9 @@ void sflphone_kdeView::on1_error(MapStringString details) qDebug() << "Signal : Daemon error : " << details; } -void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString & callID) +void sflphone_kdeView::on1_incomingCall(const QString & /*accountID*/, const QString & callID) { qDebug() << "Signal : Incoming Call ! ID = " << callID; - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); Call * call = callList->addIncomingCall(callID); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); @@ -1355,7 +1354,7 @@ void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString void sflphone_kdeView::on1_incomingMessage(const QString &accountID, const QString &message) { - qDebug() << "Signal : Incoming Message ! \nMessage : " << message; + qDebug() << "Signal : Incoming Message for account " << accountID << " ! \nMessage : " << message; } void sflphone_kdeView::on1_voiceMailNotify(const QString &accountID, int count) @@ -1363,7 +1362,7 @@ void sflphone_kdeView::on1_voiceMailNotify(const QString &accountID, int count) qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID; } -void sflphone_kdeView::on1_volumeChanged(const QString &device, double value) +void sflphone_kdeView::on1_volumeChanged(const QString & /*device*/, double value) { qDebug() << "Signal : Volume Changed !"; if(! (toolButton_recVol->isChecked() && value == 0.0))