forked from blue/squawk
some progress on upload
This commit is contained in:
parent
3f710e26d0
commit
a6e48599aa
9 changed files with 117 additions and 63 deletions
|
@ -93,6 +93,9 @@ Account::Account(const QString& p_login, const QString& p_server, const QString&
|
|||
QObject::connect(um, &QXmppUploadRequestManager::slotReceived, this, &Account::onUploadSlotReceived);
|
||||
QObject::connect(um, &QXmppUploadRequestManager::requestFailed, this, &Account::onUploadSlotRequestFailed);
|
||||
|
||||
QObject::connect(network, &NetworkAccess::uploadFileComplete, this, &Account::onFileUploaded);
|
||||
QObject::connect(network, &NetworkAccess::uploadFileError, this, &Account::onFileUploadError);
|
||||
|
||||
QString path(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
|
||||
path += "/" + name;
|
||||
QDir dir(path);
|
||||
|
@ -141,6 +144,9 @@ Account::Account(const QString& p_login, const QString& p_server, const QString&
|
|||
|
||||
Account::~Account()
|
||||
{
|
||||
QObject::disconnect(network, &NetworkAccess::uploadFileComplete, this, &Account::onFileUploaded);
|
||||
QObject::disconnect(network, &NetworkAccess::uploadFileError, this, &Account::onFileUploadError);
|
||||
|
||||
for (std::map<QString, Contact*>::const_iterator itr = contacts.begin(), end = contacts.end(); itr != end; ++itr) {
|
||||
delete itr->second;
|
||||
}
|
||||
|
@ -1640,3 +1646,11 @@ void Core::Account::onFileUploaded(const QString& messageId, const QString& url)
|
|||
pendingMessages.erase(itr);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Account::onFileUploadError(const QString& messageId, const QString& errMsg)
|
||||
{
|
||||
std::map<QString, Shared::Message>::const_iterator itr = pendingMessages.find(messageId);
|
||||
if (itr != pendingMessages.end()) {
|
||||
pendingMessages.erase(itr);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue