mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Code maintenance for Qt 5:
- Added usage of QUrlQuery - Removed QSound::isAvailable() - Changed Qt::escape() to QString::toHtmlEscaped() - Changed QAbstractItemModel::setSupportedDragActions() to virtual QAbstractItemModel::supportedDragActions() git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6851 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
68922f45a2
commit
f10f029d45
@ -51,10 +51,20 @@ RetroshareDirModel::RetroshareDirModel(bool mode, QObject *parent)
|
|||||||
{
|
{
|
||||||
_visible = false ;
|
_visible = false ;
|
||||||
_needs_update = true ;
|
_needs_update = true ;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK (5, 0, 0)
|
||||||
setSupportedDragActions(Qt::CopyAction);
|
setSupportedDragActions(Qt::CopyAction);
|
||||||
|
#endif
|
||||||
treeStyle();
|
treeStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QAbstractItemModel::setSupportedDragActions() was replaced by virtual QAbstractItemModel::supportedDragActions()
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||||
|
Qt::DropActions RetroshareDirModel::supportedDragActions() const
|
||||||
|
{
|
||||||
|
return Qt::CopyAction;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void RetroshareDirModel::update()
|
void RetroshareDirModel::update()
|
||||||
{
|
{
|
||||||
if(_needs_update)
|
if(_needs_update)
|
||||||
@ -528,7 +538,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
|||||||
if (role == Qt::TextColorRole)
|
if (role == Qt::TextColorRole)
|
||||||
{
|
{
|
||||||
if(details.min_age > ageIndicator)
|
if(details.min_age > ageIndicator)
|
||||||
return Qt::gray ;
|
return QVariant(QColor(Qt::gray)) ;
|
||||||
else
|
else
|
||||||
return QVariant() ; // standard
|
return QVariant() ; // standard
|
||||||
} /* end of TextColorRole */
|
} /* end of TextColorRole */
|
||||||
|
@ -73,6 +73,9 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||||||
virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
|
virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
|
||||||
virtual QStringList mimeTypes () const;
|
virtual QStringList mimeTypes () const;
|
||||||
virtual QVariant data(const QModelIndex &index, int role) const;
|
virtual QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||||
|
virtual Qt::DropActions supportedDragActions() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _visible ;
|
bool _visible ;
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QUrlQuery>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "RetroShareLink.h"
|
#include "RetroShareLink.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "ForumsDialog.h"
|
#include "ForumsDialog.h"
|
||||||
@ -163,6 +167,12 @@ void RetroShareLink::fromString(const QString& url)
|
|||||||
|
|
||||||
void RetroShareLink::fromUrl(const QUrl& url)
|
void RetroShareLink::fromUrl(const QUrl& url)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
const QUrlQuery urlQuery(url);
|
||||||
|
#else
|
||||||
|
const QUrl &urlQuery(url);
|
||||||
|
#endif
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// parse
|
// parse
|
||||||
@ -180,9 +190,9 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
|||||||
bool ok ;
|
bool ok ;
|
||||||
|
|
||||||
_type = TYPE_FILE;
|
_type = TYPE_FILE;
|
||||||
_name = url.queryItemValue(FILE_NAME);
|
_name = urlQuery.queryItemValue(FILE_NAME);
|
||||||
_size = url.queryItemValue(FILE_SIZE).toULongLong(&ok);
|
_size = urlQuery.queryItemValue(FILE_SIZE).toULongLong(&ok);
|
||||||
_hash = url.queryItemValue(FILE_HASH).left(40); // normally not necessary, but it's a security.
|
_hash = urlQuery.queryItemValue(FILE_HASH).left(40); // normally not necessary, but it's a security.
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
#ifdef DEBUG_RSLINK
|
#ifdef DEBUG_RSLINK
|
||||||
@ -200,9 +210,9 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
|||||||
{
|
{
|
||||||
bool ok ;
|
bool ok ;
|
||||||
_type = TYPE_PRIVATE_CHAT ;
|
_type = TYPE_PRIVATE_CHAT ;
|
||||||
_time_stamp = url.queryItemValue(PRIVATE_CHAT_TIME_STAMP).toUInt(&ok) ;
|
_time_stamp = urlQuery.queryItemValue(PRIVATE_CHAT_TIME_STAMP).toUInt(&ok) ;
|
||||||
_encrypted_chat_info = url.queryItemValue(PRIVATE_CHAT_STRING) ;
|
_encrypted_chat_info = urlQuery.queryItemValue(PRIVATE_CHAT_STRING) ;
|
||||||
_GPGid = url.queryItemValue(PRIVATE_CHAT_GPG_ID) ;
|
_GPGid = urlQuery.queryItemValue(PRIVATE_CHAT_GPG_ID) ;
|
||||||
|
|
||||||
check() ;
|
check() ;
|
||||||
return;
|
return;
|
||||||
@ -211,9 +221,9 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
|||||||
{
|
{
|
||||||
bool ok ;
|
bool ok ;
|
||||||
_type = TYPE_PUBLIC_MSG ;
|
_type = TYPE_PUBLIC_MSG ;
|
||||||
_hash = url.queryItemValue(PUBLIC_MSG_HASH) ;
|
_hash = urlQuery.queryItemValue(PUBLIC_MSG_HASH) ;
|
||||||
_time_stamp = url.queryItemValue(PUBLIC_MSG_TIME_STAMP).toUInt(&ok) ;
|
_time_stamp = urlQuery.queryItemValue(PUBLIC_MSG_TIME_STAMP).toUInt(&ok) ;
|
||||||
_GPGid = url.queryItemValue(PUBLIC_MSG_SRC_PGP_ID) ;
|
_GPGid = urlQuery.queryItemValue(PUBLIC_MSG_SRC_PGP_ID) ;
|
||||||
|
|
||||||
check() ;
|
check() ;
|
||||||
return;
|
return;
|
||||||
@ -223,10 +233,10 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
|||||||
bool ok ;
|
bool ok ;
|
||||||
|
|
||||||
_type = TYPE_EXTRAFILE;
|
_type = TYPE_EXTRAFILE;
|
||||||
_name = url.queryItemValue(FILE_NAME);
|
_name = urlQuery.queryItemValue(FILE_NAME);
|
||||||
_size = url.queryItemValue(FILE_SIZE).toULongLong(&ok);
|
_size = urlQuery.queryItemValue(FILE_SIZE).toULongLong(&ok);
|
||||||
_hash = url.queryItemValue(FILE_HASH).left(40); // normally not necessary, but it's a security.
|
_hash = urlQuery.queryItemValue(FILE_HASH).left(40); // normally not necessary, but it's a security.
|
||||||
_SSLid = url.queryItemValue(FILE_SOURCE);
|
_SSLid = urlQuery.queryItemValue(FILE_SOURCE);
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
#ifdef DEBUG_RSLINK
|
#ifdef DEBUG_RSLINK
|
||||||
@ -242,55 +252,55 @@ void RetroShareLink::fromUrl(const QUrl& url)
|
|||||||
}
|
}
|
||||||
if (url.host() == HOST_PERSON) {
|
if (url.host() == HOST_PERSON) {
|
||||||
_type = TYPE_PERSON;
|
_type = TYPE_PERSON;
|
||||||
_name = url.queryItemValue(PERSON_NAME);
|
_name = urlQuery.queryItemValue(PERSON_NAME);
|
||||||
_hash = url.queryItemValue(PERSON_HASH).left(40); // normally not necessary, but it's a security.
|
_hash = urlQuery.queryItemValue(PERSON_HASH).left(40); // normally not necessary, but it's a security.
|
||||||
check();
|
check();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.host() == HOST_FORUM) {
|
if (url.host() == HOST_FORUM) {
|
||||||
_type = TYPE_FORUM;
|
_type = TYPE_FORUM;
|
||||||
_name = url.queryItemValue(FORUM_NAME);
|
_name = urlQuery.queryItemValue(FORUM_NAME);
|
||||||
_hash = url.queryItemValue(FORUM_ID);
|
_hash = urlQuery.queryItemValue(FORUM_ID);
|
||||||
_msgId = url.queryItemValue(FORUM_MSGID);
|
_msgId = urlQuery.queryItemValue(FORUM_MSGID);
|
||||||
check();
|
check();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.host() == HOST_CHANNEL) {
|
if (url.host() == HOST_CHANNEL) {
|
||||||
_type = TYPE_CHANNEL;
|
_type = TYPE_CHANNEL;
|
||||||
_name = url.queryItemValue(CHANNEL_NAME);
|
_name = urlQuery.queryItemValue(CHANNEL_NAME);
|
||||||
_hash = url.queryItemValue(CHANNEL_ID);
|
_hash = urlQuery.queryItemValue(CHANNEL_ID);
|
||||||
_msgId = url.queryItemValue(CHANNEL_MSGID);
|
_msgId = urlQuery.queryItemValue(CHANNEL_MSGID);
|
||||||
check();
|
check();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.host() == HOST_SEARCH) {
|
if (url.host() == HOST_SEARCH) {
|
||||||
_type = TYPE_SEARCH;
|
_type = TYPE_SEARCH;
|
||||||
_name = url.queryItemValue(SEARCH_KEYWORDS);
|
_name = urlQuery.queryItemValue(SEARCH_KEYWORDS);
|
||||||
check();
|
check();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.host() == HOST_MESSAGE) {
|
if (url.host() == HOST_MESSAGE) {
|
||||||
_type = TYPE_MESSAGE;
|
_type = TYPE_MESSAGE;
|
||||||
std::string id = url.queryItemValue(MESSAGE_ID).toStdString();
|
std::string id = urlQuery.queryItemValue(MESSAGE_ID).toStdString();
|
||||||
createMessage(id, url.queryItemValue(MESSAGE_SUBJECT));
|
createMessage(id, urlQuery.queryItemValue(MESSAGE_SUBJECT));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.host() == HOST_CERTIFICATE) {
|
if (url.host() == HOST_CERTIFICATE) {
|
||||||
_type = TYPE_CERTIFICATE;
|
_type = TYPE_CERTIFICATE;
|
||||||
_SSLid = url.queryItemValue(CERTIFICATE_SSLID);
|
_SSLid = urlQuery.queryItemValue(CERTIFICATE_SSLID);
|
||||||
_name = url.queryItemValue(CERTIFICATE_NAME);
|
_name = urlQuery.queryItemValue(CERTIFICATE_NAME);
|
||||||
_location = url.queryItemValue(CERTIFICATE_LOCATION);
|
_location = urlQuery.queryItemValue(CERTIFICATE_LOCATION);
|
||||||
_GPGBase64String = url.queryItemValue(CERTIFICATE_GPG_BASE64);
|
_GPGBase64String = urlQuery.queryItemValue(CERTIFICATE_GPG_BASE64);
|
||||||
_GPGid = url.queryItemValue(CERTIFICATE_GPG_ID);
|
_GPGid = urlQuery.queryItemValue(CERTIFICATE_GPG_ID);
|
||||||
_GPGBase64CheckSum = url.queryItemValue(CERTIFICATE_GPG_CHECKSUM);
|
_GPGBase64CheckSum = urlQuery.queryItemValue(CERTIFICATE_GPG_CHECKSUM);
|
||||||
_ext_ip_port = url.queryItemValue(CERTIFICATE_EXT_IPPORT);
|
_ext_ip_port = urlQuery.queryItemValue(CERTIFICATE_EXT_IPPORT);
|
||||||
_loc_ip_port = url.queryItemValue(CERTIFICATE_LOC_IPPORT);
|
_loc_ip_port = urlQuery.queryItemValue(CERTIFICATE_LOC_IPPORT);
|
||||||
_dyndns_name = url.queryItemValue(CERTIFICATE_DYNDNS);
|
_dyndns_name = urlQuery.queryItemValue(CERTIFICATE_DYNDNS);
|
||||||
std::cerr << "Got a certificate link!!" << std::endl;
|
std::cerr << "Got a certificate link!!" << std::endl;
|
||||||
check() ;
|
check() ;
|
||||||
return;
|
return;
|
||||||
@ -728,143 +738,132 @@ static QString encodeItem(QString item)
|
|||||||
|
|
||||||
QString RetroShareLink::toString() const
|
QString RetroShareLink::toString() const
|
||||||
{
|
{
|
||||||
|
QUrl url;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QUrlQuery urlQuery;
|
||||||
|
#else
|
||||||
|
QUrl &urlQuery(url);
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case TYPE_UNKNOWN:
|
case TYPE_UNKNOWN:
|
||||||
break;
|
return "";
|
||||||
|
|
||||||
case TYPE_FILE:
|
case TYPE_FILE:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_FILE);
|
url.setHost(HOST_FILE);
|
||||||
url.addQueryItem(FILE_NAME, encodeItem(_name));
|
urlQuery.addQueryItem(FILE_NAME, encodeItem(_name));
|
||||||
url.addQueryItem(FILE_SIZE, QString::number(_size));
|
urlQuery.addQueryItem(FILE_SIZE, QString::number(_size));
|
||||||
url.addQueryItem(FILE_HASH, _hash);
|
urlQuery.addQueryItem(FILE_HASH, _hash);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
return url.toString();
|
|
||||||
}
|
|
||||||
case TYPE_PRIVATE_CHAT:
|
case TYPE_PRIVATE_CHAT:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME) ;
|
url.setScheme(RSLINK_SCHEME) ;
|
||||||
url.setHost(HOST_PRIVATE_CHAT) ;
|
url.setHost(HOST_PRIVATE_CHAT) ;
|
||||||
url.addQueryItem(PRIVATE_CHAT_TIME_STAMP,QString::number(_time_stamp)) ;
|
urlQuery.addQueryItem(PRIVATE_CHAT_TIME_STAMP,QString::number(_time_stamp)) ;
|
||||||
url.addQueryItem(PRIVATE_CHAT_GPG_ID,_GPGid) ;
|
urlQuery.addQueryItem(PRIVATE_CHAT_GPG_ID,_GPGid) ;
|
||||||
url.addQueryItem(PRIVATE_CHAT_STRING,_encrypted_chat_info) ;
|
urlQuery.addQueryItem(PRIVATE_CHAT_STRING,_encrypted_chat_info) ;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
return url.toString() ;
|
|
||||||
}
|
|
||||||
case TYPE_PUBLIC_MSG:
|
case TYPE_PUBLIC_MSG:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME) ;
|
url.setScheme(RSLINK_SCHEME) ;
|
||||||
url.setHost(HOST_PUBLIC_MSG) ;
|
url.setHost(HOST_PUBLIC_MSG) ;
|
||||||
url.addQueryItem(PUBLIC_MSG_TIME_STAMP,QString::number(_time_stamp)) ;
|
urlQuery.addQueryItem(PUBLIC_MSG_TIME_STAMP,QString::number(_time_stamp)) ;
|
||||||
url.addQueryItem(PUBLIC_MSG_HASH,_hash) ;
|
urlQuery.addQueryItem(PUBLIC_MSG_HASH,_hash) ;
|
||||||
url.addQueryItem(PUBLIC_MSG_SRC_PGP_ID,_GPGid) ;
|
urlQuery.addQueryItem(PUBLIC_MSG_SRC_PGP_ID,_GPGid) ;
|
||||||
|
|
||||||
return url.toString() ;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case TYPE_EXTRAFILE:
|
case TYPE_EXTRAFILE:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_EXTRAFILE);
|
url.setHost(HOST_EXTRAFILE);
|
||||||
url.addQueryItem(FILE_NAME, encodeItem(_name));
|
urlQuery.addQueryItem(FILE_NAME, encodeItem(_name));
|
||||||
url.addQueryItem(FILE_SIZE, QString::number(_size));
|
urlQuery.addQueryItem(FILE_SIZE, QString::number(_size));
|
||||||
url.addQueryItem(FILE_HASH, _hash);
|
urlQuery.addQueryItem(FILE_HASH, _hash);
|
||||||
url.addQueryItem(FILE_SOURCE, _SSLid);
|
urlQuery.addQueryItem(FILE_SOURCE, _SSLid);
|
||||||
|
|
||||||
return url.toString();
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case TYPE_PERSON:
|
case TYPE_PERSON:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_PERSON);
|
url.setHost(HOST_PERSON);
|
||||||
url.addQueryItem(PERSON_NAME, encodeItem(_name));
|
urlQuery.addQueryItem(PERSON_NAME, encodeItem(_name));
|
||||||
url.addQueryItem(PERSON_HASH, _hash);
|
urlQuery.addQueryItem(PERSON_HASH, _hash);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
return url.toString();
|
|
||||||
}
|
|
||||||
case TYPE_FORUM:
|
case TYPE_FORUM:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_FORUM);
|
url.setHost(HOST_FORUM);
|
||||||
url.addQueryItem(FORUM_NAME, encodeItem(_name));
|
urlQuery.addQueryItem(FORUM_NAME, encodeItem(_name));
|
||||||
url.addQueryItem(FORUM_ID, _hash);
|
urlQuery.addQueryItem(FORUM_ID, _hash);
|
||||||
if (!_msgId.isEmpty()) {
|
if (!_msgId.isEmpty()) {
|
||||||
url.addQueryItem(FORUM_MSGID, _msgId);
|
urlQuery.addQueryItem(FORUM_MSGID, _msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return url.toString();
|
break;
|
||||||
}
|
|
||||||
case TYPE_CHANNEL:
|
case TYPE_CHANNEL:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_CHANNEL);
|
url.setHost(HOST_CHANNEL);
|
||||||
url.addQueryItem(CHANNEL_NAME, encodeItem(_name));
|
urlQuery.addQueryItem(CHANNEL_NAME, encodeItem(_name));
|
||||||
url.addQueryItem(CHANNEL_ID, _hash);
|
urlQuery.addQueryItem(CHANNEL_ID, _hash);
|
||||||
if (!_msgId.isEmpty()) {
|
if (!_msgId.isEmpty()) {
|
||||||
url.addQueryItem(CHANNEL_MSGID, _msgId);
|
urlQuery.addQueryItem(CHANNEL_MSGID, _msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return url.toString();
|
break;
|
||||||
}
|
|
||||||
case TYPE_SEARCH:
|
case TYPE_SEARCH:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_SEARCH);
|
url.setHost(HOST_SEARCH);
|
||||||
url.addQueryItem(SEARCH_KEYWORDS, encodeItem(_name));
|
urlQuery.addQueryItem(SEARCH_KEYWORDS, encodeItem(_name));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
return url.toString();
|
|
||||||
}
|
|
||||||
case TYPE_MESSAGE:
|
case TYPE_MESSAGE:
|
||||||
{
|
|
||||||
QUrl url;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_MESSAGE);
|
url.setHost(HOST_MESSAGE);
|
||||||
url.addQueryItem(MESSAGE_ID, _hash);
|
urlQuery.addQueryItem(MESSAGE_ID, _hash);
|
||||||
if (_subject.isEmpty() == false) {
|
if (_subject.isEmpty() == false) {
|
||||||
url.addQueryItem(MESSAGE_SUBJECT, encodeItem(_subject));
|
urlQuery.addQueryItem(MESSAGE_SUBJECT, encodeItem(_subject));
|
||||||
}
|
}
|
||||||
|
|
||||||
return url.toString();
|
break;
|
||||||
}
|
|
||||||
case TYPE_CERTIFICATE:
|
case TYPE_CERTIFICATE:
|
||||||
{
|
|
||||||
QUrl url ;
|
|
||||||
url.setScheme(RSLINK_SCHEME);
|
url.setScheme(RSLINK_SCHEME);
|
||||||
url.setHost(HOST_CERTIFICATE) ;
|
url.setHost(HOST_CERTIFICATE) ;
|
||||||
if (!_SSLid.isEmpty()) {
|
if (!_SSLid.isEmpty()) {
|
||||||
url.addQueryItem(CERTIFICATE_SSLID, _SSLid);
|
urlQuery.addQueryItem(CERTIFICATE_SSLID, _SSLid);
|
||||||
}
|
}
|
||||||
url.addQueryItem(CERTIFICATE_GPG_ID, _GPGid);
|
urlQuery.addQueryItem(CERTIFICATE_GPG_ID, _GPGid);
|
||||||
url.addQueryItem(CERTIFICATE_GPG_BASE64, _GPGBase64String);
|
urlQuery.addQueryItem(CERTIFICATE_GPG_BASE64, _GPGBase64String);
|
||||||
url.addQueryItem(CERTIFICATE_GPG_CHECKSUM, _GPGBase64CheckSum);
|
urlQuery.addQueryItem(CERTIFICATE_GPG_CHECKSUM, _GPGBase64CheckSum);
|
||||||
if (!_location.isEmpty()) {
|
if (!_location.isEmpty()) {
|
||||||
url.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
|
urlQuery.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
|
||||||
}
|
}
|
||||||
url.addQueryItem(CERTIFICATE_NAME, encodeItem(_name));
|
urlQuery.addQueryItem(CERTIFICATE_NAME, encodeItem(_name));
|
||||||
if (!_loc_ip_port.isEmpty()) {
|
if (!_loc_ip_port.isEmpty()) {
|
||||||
url.addQueryItem(CERTIFICATE_LOC_IPPORT, encodeItem(_loc_ip_port));
|
urlQuery.addQueryItem(CERTIFICATE_LOC_IPPORT, encodeItem(_loc_ip_port));
|
||||||
}
|
}
|
||||||
if (!_ext_ip_port.isEmpty()) {
|
if (!_ext_ip_port.isEmpty()) {
|
||||||
url.addQueryItem(CERTIFICATE_EXT_IPPORT, encodeItem(_ext_ip_port));
|
urlQuery.addQueryItem(CERTIFICATE_EXT_IPPORT, encodeItem(_ext_ip_port));
|
||||||
}
|
}
|
||||||
if (!_dyndns_name.isEmpty()) {
|
if (!_dyndns_name.isEmpty()) {
|
||||||
url.addQueryItem(CERTIFICATE_DYNDNS, encodeItem(_dyndns_name));
|
urlQuery.addQueryItem(CERTIFICATE_DYNDNS, encodeItem(_dyndns_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
url.setQuery(urlQuery);
|
||||||
|
#endif
|
||||||
|
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RetroShareLink::niceName() const
|
QString RetroShareLink::niceName() const
|
||||||
|
@ -115,7 +115,13 @@ void SoundManager::setEventFilename(const QString &event, const QString &filenam
|
|||||||
|
|
||||||
void SoundManager::play(const QString &event)
|
void SoundManager::play(const QString &event)
|
||||||
{
|
{
|
||||||
if (isMute() || !QSound::isAvailable() || !eventEnabled(event)) {
|
#if QT_VERSION < QT_VERSION_CHECK (5, 0, 0)
|
||||||
|
if (!QSound::isAvailable()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (isMute() || !eventEnabled(event)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QUrlQuery>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ConnectFriendWizard.h"
|
#include "ConnectFriendWizard.h"
|
||||||
#include "ui_ConnectFriendWizard.h"
|
#include "ui_ConnectFriendWizard.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
@ -435,8 +439,19 @@ static void sendMail(QString sAddress, QString sSubject, QString sBody)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QUrl url = QUrl("mailto:" + sAddress);
|
QUrl url = QUrl("mailto:" + sAddress);
|
||||||
url.addEncodedQueryItem("subject", QUrl::toPercentEncoding(sSubject));
|
|
||||||
url.addEncodedQueryItem("body", QUrl::toPercentEncoding(sBody));
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QUrlQuery urlQuery;
|
||||||
|
#else
|
||||||
|
QUrl &urlQuery(url);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
urlQuery.addQueryItem("subject", sSubject);
|
||||||
|
urlQuery.addQueryItem("body", sBody);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
url.setQuery(urlQuery);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::cerr << "MAIL STRING:" << (std::string)url.toEncoded().constData() << std::endl;
|
std::cerr << "MAIL STRING:" << (std::string)url.toEncoded().constData() << std::endl;
|
||||||
|
|
||||||
|
@ -131,7 +131,12 @@ bool IdlePlatform::init()
|
|||||||
{
|
{
|
||||||
if(d->lib)
|
if(d->lib)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
QFunctionPointer p;
|
||||||
|
#else
|
||||||
void *p;
|
void *p;
|
||||||
|
#endif
|
||||||
|
|
||||||
// try to find the built-in Windows 2000 function
|
// try to find the built-in Windows 2000 function
|
||||||
d->lib = new QLibrary("user32");
|
d->lib = new QLibrary("user32");
|
||||||
|
@ -176,7 +176,7 @@ win32 {
|
|||||||
# create lib directory
|
# create lib directory
|
||||||
QMAKE_PRE_LINK = $(CHK_DIR_EXISTS) lib $(MKDIR) lib
|
QMAKE_PRE_LINK = $(CHK_DIR_EXISTS) lib $(MKDIR) lib
|
||||||
|
|
||||||
DEFINES += WINDOWS_SYS
|
DEFINES *= WINDOWS_SYS WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
||||||
|
|
||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
}
|
}
|
||||||
|
@ -795,10 +795,18 @@ bool RsHtml::makeEmbeddedImage(const QImage &originalImage, QString &embeddedIma
|
|||||||
|
|
||||||
QString RsHtml::plainText(const QString &text)
|
QString RsHtml::plainText(const QString &text)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
return text.toHtmlEscaped();
|
||||||
|
#else
|
||||||
return Qt::escape(text);
|
return Qt::escape(text);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RsHtml::plainText(const std::string &text)
|
QString RsHtml::plainText(const std::string &text)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
return QString::fromUtf8(text.c_str()).toHtmlEscaped();
|
||||||
|
#else
|
||||||
return Qt::escape(QString::fromUtf8(text.c_str()));
|
return Qt::escape(QString::fromUtf8(text.c_str()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user