mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-18 11:58:11 +00:00
- Add feedback on errors - More generic import requests - Replace storing password by a native popup that ask passwork when needed - Store passwords in settings file - Import Feedback in advanced settings tab - Use English as default translator if no translations are found - Add OpenSSL packaging for Windows to deal with Qt connections - Add option to overwrite plugin if exists - Plugin load/unload managment. Hot-Dynamic load of plugins. Safely test the loaded plugin - Set plugin data with default value when all GUI items are loaded - Rewrite folder priority - Add filename info from pluginloader - Add plugin versionning - Specify inputs for saving - Copy desktop headers in OUTPUT to be used by external projects - Add a plugins folder auto-managed by cmake - Remove obsolete contact api submodule - Clean plugin example - Add specific behaviour for plugin type : inputs have been splitted by Capability. - Update save/load to be more generic and add clean function for configurations - Instantiate Importer List model - Add IDE integration for plugins - Set input fields to be dependent of capability - Change signals interface to take account capability
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#include "NetworkAPI.hpp"
|
|
#include "DataAPI.hpp"
|
|
|
|
#include <QInputDialog>
|
|
#include <LinphoneApp/PluginDataAPI.hpp>
|
|
|
|
|
|
NetworkAPI::NetworkAPI(DataAPI * data) : mData(data){
|
|
if(mData ) {
|
|
connect(this, SIGNAL(requestFinished(const QByteArray&)), mData, SLOT(parse(const QByteArray&)));
|
|
connect(this, &NetworkAPI::message, mData, &DataAPI::message);
|
|
}
|
|
}
|
|
|
|
NetworkAPI::~NetworkAPI(){
|
|
}
|
|
|
|
bool NetworkAPI::isEnabled()const{
|
|
return mData && mData->isEnabled();
|
|
}
|
|
bool NetworkAPI::isValid(PluginDataAPI * pData, const bool &pShowError){
|
|
QString errorMessage;
|
|
DataAPI * data = dynamic_cast<DataAPI*>(pData);
|
|
bool ok = data;
|
|
if(!ok)
|
|
errorMessage = "These data are invalid";
|
|
else
|
|
ok = pData->isValid(true, &errorMessage);
|
|
if(!ok && pShowError){
|
|
qWarning() << errorMessage;
|
|
emit message(QtMsgType::QtWarningMsg, errorMessage);
|
|
}
|
|
return ok;
|
|
}
|
|
//-----------------------------------------------------------------------------------------
|
|
|
|
QString NetworkAPI::prepareRequest()const{
|
|
QString url = mData->getUrl()+"?user="+mData->getUsername()+"&";
|
|
if( mData->getKey() != "")
|
|
url += "key="+mData->getKey();
|
|
else
|
|
url += "password="+mData->getPassword();
|
|
return url;
|
|
}
|
|
|
|
void NetworkAPI::startRequest() {
|
|
bool doRequest = false;
|
|
if(isValid(mData)){
|
|
if(isEnabled()){
|
|
mCurrentStep=0;
|
|
doRequest = true;
|
|
}
|
|
}
|
|
if(doRequest)
|
|
request();
|
|
else
|
|
mData->parse(QByteArray());
|
|
}
|