Removed conditional code.
This commit is contained in:
parent
b871716d61
commit
ff286f3d62
@ -234,7 +234,7 @@ message(STATUS "[${APP_LOW_NAME}] Enabling fast QString concatenation.")
|
|||||||
add_definitions(-DQT_USE_FAST_CONCATENATION)
|
add_definitions(-DQT_USE_FAST_CONCATENATION)
|
||||||
add_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
|
add_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
|
||||||
|
|
||||||
# Configure executable "properties" for Windows or OS2.
|
# Configure executable "properties" for Windows.
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
message(STATUS "[${APP_LOW_NAME}] Generating executable file properties for Windows.")
|
message(STATUS "[${APP_LOW_NAME}] Generating executable file properties for Windows.")
|
||||||
configure_file (
|
configure_file (
|
||||||
@ -248,7 +248,7 @@ if(WIN32 AND MSVC)
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.01" )
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.01" )
|
||||||
endif(WIN32 AND MSVC)
|
endif(WIN32 AND MSVC)
|
||||||
|
|
||||||
# Compile application icon if compiling with MinGW on WIN32 or with OS2.
|
# Compile application icon if compiling with MinGW on WIN32.
|
||||||
if(WIN32 AND MINGW)
|
if(WIN32 AND MINGW)
|
||||||
enable_language(RC)
|
enable_language(RC)
|
||||||
set(CMAKE_RC_COMPILER_INIT windres)
|
set(CMAKE_RC_COMPILER_INIT windres)
|
||||||
|
@ -162,12 +162,7 @@ void MessagesModel::setupHeaderData() {
|
|||||||
Qt::ItemFlags MessagesModel::flags(const QModelIndex &index) const {
|
Qt::ItemFlags MessagesModel::flags(const QModelIndex &index) const {
|
||||||
Q_UNUSED(index)
|
Q_UNUSED(index)
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemNeverHasChildren;
|
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemNeverHasChildren;
|
||||||
#else
|
|
||||||
|
|
||||||
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant MessagesModel::data(int row, int column, int role) const {
|
QVariant MessagesModel::data(int row, int column, int role) const {
|
||||||
|
@ -152,16 +152,12 @@
|
|||||||
#define APP_THEME_SUFFIX ".png"
|
#define APP_THEME_SUFFIX ".png"
|
||||||
|
|
||||||
#ifndef QSL
|
#ifndef QSL
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Thin macro wrapper for literal strings.
|
// Thin macro wrapper for literal strings.
|
||||||
// They are much more memory efficient and faster.
|
// They are much more memory efficient and faster.
|
||||||
// Use it for all literals except for two cases:
|
// Use it for all literals except for two cases:
|
||||||
// a) Methods which take QLatin1String (use QLatin1String for literal argument too),
|
// a) Methods which take QLatin1String (use QLatin1String for literal argument too),
|
||||||
// b) Construction of empty literals "", use QString() instead of QStringLiteral("").
|
// b) Construction of empty literals "", use QString() instead of QStringLiteral("").
|
||||||
#define QSL(x) QStringLiteral(x)
|
#define QSL(x) QStringLiteral(x)
|
||||||
#else
|
|
||||||
#define QSL(x) QLatin1String(x)
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QL1S
|
#ifndef QL1S
|
||||||
|
@ -85,7 +85,6 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
|
|||||||
<< tr("Author")
|
<< tr("Author")
|
||||||
<< tr("E-mail"));
|
<< tr("E-mail"));
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Setup languages.
|
// Setup languages.
|
||||||
m_ui->m_treeLanguages->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
m_ui->m_treeLanguages->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||||
m_ui->m_treeLanguages->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
m_ui->m_treeLanguages->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
@ -98,20 +97,6 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
|
|||||||
m_ui->m_treeSkins->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
m_ui->m_treeSkins->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
m_ui->m_treeSkins->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
m_ui->m_treeSkins->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
||||||
m_ui->m_treeSkins->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
m_ui->m_treeSkins->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
// Setup languages.
|
|
||||||
m_ui->m_treeLanguages->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
|
||||||
m_ui->m_treeLanguages->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
|
||||||
m_ui->m_treeLanguages->header()->setResizeMode(2, QHeaderView::ResizeToContents);
|
|
||||||
m_ui->m_treeLanguages->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
|
||||||
m_ui->m_treeLanguages->header()->setResizeMode(4, QHeaderView::ResizeToContents);
|
|
||||||
|
|
||||||
// Setup skins.
|
|
||||||
m_ui->m_treeSkins->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
|
||||||
m_ui->m_treeSkins->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
|
||||||
m_ui->m_treeSkins->header()->setResizeMode(2, QHeaderView::ResizeToContents);
|
|
||||||
m_ui->m_treeSkins->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Establish needed connections.
|
// Establish needed connections.
|
||||||
connect(m_ui->m_buttonBox, SIGNAL(accepted()), this, SLOT(saveSettings()));
|
connect(m_ui->m_buttonBox, SIGNAL(accepted()), this, SLOT(saveSettings()));
|
||||||
@ -749,15 +734,7 @@ void FormSettings::loadInterface() {
|
|||||||
m_ui->m_cmbIconTheme->setCurrentIndex(0);
|
m_ui->m_cmbIconTheme->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
m_ui->m_cmbIconTheme->setCurrentText(current_theme);
|
m_ui->m_cmbIconTheme->setCurrentText(current_theme);
|
||||||
#else
|
|
||||||
int theme_index = m_ui->m_cmbIconTheme->findText(current_theme);
|
|
||||||
|
|
||||||
if (theme_index >= 0) {
|
|
||||||
m_ui->m_cmbIconTheme->setCurrentIndex(theme_index);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load skin.
|
// Load skin.
|
||||||
|
@ -433,15 +433,9 @@ QMenu *FeedsView::initializeContextMenuOtherItem(RootItem *clicked_item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::setupAppearance() {
|
void FeedsView::setupAppearance() {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Setup column resize strategies.
|
// Setup column resize strategies.
|
||||||
header()->setSectionResizeMode(FDS_MODEL_TITLE_INDEX, QHeaderView::Stretch);
|
header()->setSectionResizeMode(FDS_MODEL_TITLE_INDEX, QHeaderView::Stretch);
|
||||||
header()->setSectionResizeMode(FDS_MODEL_COUNTS_INDEX, QHeaderView::ResizeToContents);
|
header()->setSectionResizeMode(FDS_MODEL_COUNTS_INDEX, QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
// Setup column resize strategies.
|
|
||||||
header()->setResizeMode(FDS_MODEL_TITLE_INDEX, QHeaderView::Stretch);
|
|
||||||
header()->setResizeMode(FDS_MODEL_COUNTS_INDEX, QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
setAnimated(true);
|
setAnimated(true);
|
||||||
|
@ -231,13 +231,11 @@ void MessagesView::loadItem(RootItem *item) {
|
|||||||
m_sourceModel->setSort(col, ord);
|
m_sourceModel->setSort(col, ord);
|
||||||
m_sourceModel->loadMessages(item);
|
m_sourceModel->loadMessages(item);
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Messages are loaded, make sure that previously
|
// Messages are loaded, make sure that previously
|
||||||
// active message is not shown in browser.
|
// active message is not shown in browser.
|
||||||
// BUG: Qt 5 is probably bugged here. Selections
|
// BUG: Qt 5 is probably bugged here. Selections
|
||||||
// should be cleared automatically when SQL model is reset.
|
// should be cleared automatically when SQL model is reset.
|
||||||
emit currentMessagesRemoved();
|
emit currentMessagesRemoved();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesView::openSelectedSourceMessagesExternally() {
|
void MessagesView::openSelectedSourceMessagesExternally() {
|
||||||
@ -506,7 +504,6 @@ void MessagesView::adjustColumns() {
|
|||||||
if (header()->count() > 0 && !m_columnsAdjusted) {
|
if (header()->count() > 0 && !m_columnsAdjusted) {
|
||||||
m_columnsAdjusted = true;
|
m_columnsAdjusted = true;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Setup column resize strategies.
|
// Setup column resize strategies.
|
||||||
header()->setSectionResizeMode(MSG_DB_ID_INDEX, QHeaderView::Interactive);
|
header()->setSectionResizeMode(MSG_DB_ID_INDEX, QHeaderView::Interactive);
|
||||||
header()->setSectionResizeMode(MSG_DB_READ_INDEX, QHeaderView::ResizeToContents);
|
header()->setSectionResizeMode(MSG_DB_READ_INDEX, QHeaderView::ResizeToContents);
|
||||||
@ -519,20 +516,6 @@ void MessagesView::adjustColumns() {
|
|||||||
header()->setSectionResizeMode(MSG_DB_DCREATED_INDEX, QHeaderView::Interactive);
|
header()->setSectionResizeMode(MSG_DB_DCREATED_INDEX, QHeaderView::Interactive);
|
||||||
header()->setSectionResizeMode(MSG_DB_CONTENTS_INDEX, QHeaderView::Interactive);
|
header()->setSectionResizeMode(MSG_DB_CONTENTS_INDEX, QHeaderView::Interactive);
|
||||||
header()->setSectionResizeMode(MSG_DB_PDELETED_INDEX, QHeaderView::Interactive);
|
header()->setSectionResizeMode(MSG_DB_PDELETED_INDEX, QHeaderView::Interactive);
|
||||||
#else
|
|
||||||
// Setup column resize strategies.
|
|
||||||
header()->setResizeMode(MSG_DB_ID_INDEX, QHeaderView::Interactive);
|
|
||||||
header()->setResizeMode(MSG_DB_READ_INDEX, QHeaderView::ResizeToContents);
|
|
||||||
header()->setResizeMode(MSG_DB_DELETED_INDEX, QHeaderView::Interactive);
|
|
||||||
header()->setResizeMode(MSG_DB_IMPORTANT_INDEX, QHeaderView::ResizeToContents);
|
|
||||||
header()->setResizeMode(MSG_DB_FEED_INDEX, QHeaderView::Interactive);
|
|
||||||
header()->setResizeMode(MSG_DB_TITLE_INDEX, QHeaderView::Stretch);
|
|
||||||
header()->setResizeMode(MSG_DB_URL_INDEX, QHeaderView::Interactive);
|
|
||||||
header()->setResizeMode(MSG_DB_AUTHOR_INDEX, QHeaderView::Interactive);
|
|
||||||
header()->setResizeMode(MSG_DB_DCREATED_INDEX, QHeaderView::Interactive);
|
|
||||||
header()->setResizeMode(MSG_DB_CONTENTS_INDEX, QHeaderView::Interactive);
|
|
||||||
header()->setResizeMode(MSG_DB_PDELETED_INDEX, QHeaderView::Interactive);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Hide columns.
|
// Hide columns.
|
||||||
hideColumn(MSG_DB_ID_INDEX);
|
hideColumn(MSG_DB_ID_INDEX);
|
||||||
|
@ -221,11 +221,7 @@ void Notification::paintEvent(QPaintEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw background.
|
// Draw background.
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
painter.setRenderHints(QPainter::HighQualityAntialiasing | QPainter::Qt4CompatiblePainting);
|
painter.setRenderHints(QPainter::HighQualityAntialiasing | QPainter::Qt4CompatiblePainting);
|
||||||
#else
|
|
||||||
painter.setRenderHints(QPainter::HighQualityAntialiasing);
|
|
||||||
#endif
|
|
||||||
painter.setBrush(m_backgroundColor);
|
painter.setBrush(m_backgroundColor);
|
||||||
|
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
@ -287,9 +283,7 @@ void Notification::setupWidget() {
|
|||||||
Qt::WindowFlags window_flags = Qt::FramelessWindowHint | Qt::WindowSystemMenuHint |
|
Qt::WindowFlags window_flags = Qt::FramelessWindowHint | Qt::WindowSystemMenuHint |
|
||||||
Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint;
|
Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
window_flags |= Qt::WindowDoesNotAcceptFocus;
|
window_flags |= Qt::WindowDoesNotAcceptFocus;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (Q_OS_MAC)
|
#if defined (Q_OS_MAC)
|
||||||
window_flags |= Qt::SubWindow;
|
window_flags |= Qt::SubWindow;
|
||||||
|
@ -56,11 +56,7 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Setup debug output system.
|
// Setup debug output system.
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
qInstallMessageHandler(Debugging::debugHandler);
|
qInstallMessageHandler(Debugging::debugHandler);
|
||||||
#else
|
|
||||||
qInstallMsgHandler(Debugging::debugHandler);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Instantiate base application object.
|
// Instantiate base application object.
|
||||||
Application application(APP_LOW_NAME, argc, argv);
|
Application application(APP_LOW_NAME, argc, argv);
|
||||||
|
@ -62,7 +62,6 @@ const char *Debugging::typeToString(QtMsgType type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
void Debugging::debugHandler(QtMsgType type, const QMessageLogContext &placement, const QString &message) {
|
void Debugging::debugHandler(QtMsgType type, const QMessageLogContext &placement, const QString &message) {
|
||||||
#ifndef QT_NO_DEBUG_OUTPUT
|
#ifndef QT_NO_DEBUG_OUTPUT
|
||||||
performLog(qPrintable(message), type, placement.file, placement.function, placement.line);
|
performLog(qPrintable(message), type, placement.file, placement.function, placement.line);
|
||||||
@ -72,13 +71,3 @@ void Debugging::debugHandler(QtMsgType type, const QMessageLogContext &placement
|
|||||||
Q_UNUSED(message)
|
Q_UNUSED(message)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void Debugging::debugHandler(QtMsgType type, const char *message) {
|
|
||||||
#ifndef QT_NO_DEBUG_OUTPUT
|
|
||||||
performLog(message, type);
|
|
||||||
#else
|
|
||||||
Q_UNUSED(type)
|
|
||||||
Q_UNUSED(message)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -25,12 +25,7 @@ class Debugging {
|
|||||||
public:
|
public:
|
||||||
// Specifies format of output console messages.
|
// Specifies format of output console messages.
|
||||||
// NOTE: QT_NO_DEBUG_OUTPUT - disables debug outputs completely!!!
|
// NOTE: QT_NO_DEBUG_OUTPUT - disables debug outputs completely!!!
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
static void debugHandler(QtMsgType type, const QMessageLogContext &placement, const QString &message);
|
static void debugHandler(QtMsgType type, const QMessageLogContext &placement, const QString &message);
|
||||||
#else
|
|
||||||
static void debugHandler(QtMsgType type, const char *message);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void performLog(const char *message, QtMsgType type, const char *file = 0, const char *function = 0, int line = -1);
|
static void performLog(const char *message, QtMsgType type, const char *file = 0, const char *function = 0, int line = -1);
|
||||||
static const char *typeToString(QtMsgType type);
|
static const char *typeToString(QtMsgType type);
|
||||||
|
|
||||||
|
@ -31,11 +31,7 @@ IOFactory::IOFactory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::StandardLocation location) {
|
QString IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::StandardLocation location) {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return SYSTEM_FOLDER_ENUM::writableLocation(location);
|
return SYSTEM_FOLDER_ENUM::writableLocation(location);
|
||||||
#else
|
|
||||||
return SYSTEM_FOLDER_ENUM::storageLocation(location);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IOFactory::ensureUniqueFilename(const QString &name, const QString &append_format) {
|
QString IOFactory::ensureUniqueFilename(const QString &name, const QString &append_format) {
|
||||||
|
@ -22,13 +22,8 @@
|
|||||||
|
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#define SYSTEM_FOLDER_ENUM QStandardPaths
|
#define SYSTEM_FOLDER_ENUM QStandardPaths
|
||||||
#else
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#define SYSTEM_FOLDER_ENUM QDesktopServices
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class IOFactory {
|
class IOFactory {
|
||||||
|
@ -76,12 +76,7 @@ QList<Language> Localization::installedLanguages() const {
|
|||||||
new_language.m_version = translator.translate("QObject", "LANG_VERSION");
|
new_language.m_version = translator.translate("QObject", "LANG_VERSION");
|
||||||
new_language.m_author = translator.translate("QObject", "LANG_AUTHOR");
|
new_language.m_author = translator.translate("QObject", "LANG_AUTHOR");
|
||||||
new_language.m_email = translator.translate("QObject", "LANG_EMAIL");
|
new_language.m_email = translator.translate("QObject", "LANG_EMAIL");
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
new_language.m_name = QLocale(new_language.m_code).nativeLanguageName();
|
new_language.m_name = QLocale(new_language.m_code).nativeLanguageName();
|
||||||
#else
|
|
||||||
new_language.m_name = translator.translate("QObject", "LANG_NAME");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
languages << new_language;
|
languages << new_language;
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,7 @@
|
|||||||
#include <QDomAttr>
|
#include <QDomAttr>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <QtConcurrent/QtConcurrentRun>
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
#else
|
|
||||||
#include <QtConcurrentRun>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef QPair<UpdateInfo, QNetworkReply::NetworkError> UpdateCheck;
|
typedef QPair<UpdateInfo, QNetworkReply::NetworkError> UpdateCheck;
|
||||||
|
@ -132,11 +132,7 @@ QNetworkReply::NetworkError NetworkFactory::downloadIcon(const QList<QString> &u
|
|||||||
QNetworkReply::NetworkError network_result;
|
QNetworkReply::NetworkError network_result;
|
||||||
|
|
||||||
foreach (const QString &url, urls) {
|
foreach (const QString &url, urls) {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
const QString google_s2_with_url = QString("http://www.google.com/s2/favicons?domain=%1").arg(url.toHtmlEscaped());
|
const QString google_s2_with_url = QString("http://www.google.com/s2/favicons?domain=%1").arg(url.toHtmlEscaped());
|
||||||
#else
|
|
||||||
const QString google_s2_with_url = QString("http://www.google.com/s2/favicons?domain=%1").arg(Qt::escape(url));
|
|
||||||
#endif
|
|
||||||
QByteArray icon_data;
|
QByteArray icon_data;
|
||||||
network_result = downloadFile(google_s2_with_url, timeout, icon_data).first;
|
network_result = downloadFile(google_s2_with_url, timeout, icon_data).first;
|
||||||
|
|
||||||
|
@ -146,7 +146,6 @@ QString WebFactory::deEscapeHtml(const QString &text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString WebFactory::toSecondLevelDomain(const QUrl &url) {
|
QString WebFactory::toSecondLevelDomain(const QUrl &url) {
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
const QString top_level_domain = url.topLevelDomain();
|
const QString top_level_domain = url.topLevelDomain();
|
||||||
const QString url_host = url.host();
|
const QString url_host = url.host();
|
||||||
|
|
||||||
@ -165,19 +164,6 @@ QString WebFactory::toSecondLevelDomain(const QUrl &url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return domain + top_level_domain;
|
return domain + top_level_domain;
|
||||||
#else
|
|
||||||
QString domain = url.host();
|
|
||||||
|
|
||||||
if (domain.count(QL1C('.')) == 0) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
while (domain.count(QL1C('.')) != 1) {
|
|
||||||
domain = domain.mid(domain.indexOf(QL1C('.')) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return domain;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebFactory::generetaEscapes() {
|
void WebFactory::generetaEscapes() {
|
||||||
|
@ -37,12 +37,7 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <QtPrintSupport/QPrintPreviewDialog>
|
#include <QtPrintSupport/QPrintPreviewDialog>
|
||||||
#else
|
|
||||||
#include <QPrintPreviewDialog>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
WebView::WebView(QWidget *parent)
|
WebView::WebView(QWidget *parent)
|
||||||
@ -168,11 +163,7 @@ void WebView::setupIcons() {
|
|||||||
m_actionCopyImage->setIcon(qApp->icons()->fromTheme(QSL("edit-copy-image")));
|
m_actionCopyImage->setIcon(qApp->icons()->fromTheme(QSL("edit-copy-image")));
|
||||||
m_actionSaveHyperlinkAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
|
m_actionSaveHyperlinkAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
|
||||||
m_actionSaveImageAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
|
m_actionSaveImageAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
m_actionCopyImageUrl->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
|
m_actionCopyImageUrl->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
|
||||||
#endif
|
|
||||||
|
|
||||||
m_actionOpenLinkThisTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
|
m_actionOpenLinkThisTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
|
||||||
m_actionOpenLinkNewTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
|
m_actionOpenLinkNewTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
|
||||||
m_actionOpenLinkExternally->setIcon(qApp->icons()->fromTheme(QSL("item-open-external")));
|
m_actionOpenLinkExternally->setIcon(qApp->icons()->fromTheme(QSL("item-open-external")));
|
||||||
@ -192,11 +183,6 @@ void WebView::initializeActions() {
|
|||||||
m_actionCopySelectedItem = pageAction(QWebEnginePage::Copy);
|
m_actionCopySelectedItem = pageAction(QWebEnginePage::Copy);
|
||||||
m_actionCopySelectedItem->setParent(this);
|
m_actionCopySelectedItem->setParent(this);
|
||||||
|
|
||||||
#if defined(Q_OS_OS2)
|
|
||||||
m_actionCopySelectedItem->setShortcut(QKeySequence::Copy);
|
|
||||||
addAction(m_actionCopySelectedItem);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_actionSaveHyperlinkAs = pageAction(QWebEnginePage::DownloadLinkToDisk);
|
m_actionSaveHyperlinkAs = pageAction(QWebEnginePage::DownloadLinkToDisk);
|
||||||
m_actionSaveHyperlinkAs->setParent(this);
|
m_actionSaveHyperlinkAs->setParent(this);
|
||||||
|
|
||||||
@ -210,10 +196,8 @@ void WebView::initializeActions() {
|
|||||||
m_actionSaveImageAs->setParent(this);
|
m_actionSaveImageAs->setParent(this);
|
||||||
m_actionSavePageAs = new QAction(qApp->icons()->fromTheme(QSL("document-download")), tr("Save page as..."), this);
|
m_actionSavePageAs = new QAction(qApp->icons()->fromTheme(QSL("document-download")), tr("Save page as..."), this);
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
m_actionCopyImageUrl = pageAction(QWebEnginePage::CopyImageUrlToClipboard);
|
m_actionCopyImageUrl = pageAction(QWebEnginePage::CopyImageUrlToClipboard);
|
||||||
m_actionCopyImageUrl->setParent(this);
|
m_actionCopyImageUrl->setParent(this);
|
||||||
#endif
|
|
||||||
|
|
||||||
m_actionOpenLinkNewTab = pageAction(QWebEnginePage::OpenLinkInNewTab);
|
m_actionOpenLinkNewTab = pageAction(QWebEnginePage::OpenLinkInNewTab);
|
||||||
m_actionOpenLinkNewTab->setParent(this);
|
m_actionOpenLinkNewTab->setParent(this);
|
||||||
@ -244,10 +228,8 @@ void WebView::setActionTexts() {
|
|||||||
m_actionSaveImageAs->setText(tr("Save image as..."));
|
m_actionSaveImageAs->setText(tr("Save image as..."));
|
||||||
m_actionSaveImageAs->setToolTip(tr("Save image to disk."));
|
m_actionSaveImageAs->setToolTip(tr("Save image to disk."));
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
m_actionCopyImageUrl->setText(tr("Copy image url"));
|
m_actionCopyImageUrl->setText(tr("Copy image url"));
|
||||||
m_actionCopyImageUrl->setToolTip(tr("Copy image url to clipboard."));
|
m_actionCopyImageUrl->setToolTip(tr("Copy image url to clipboard."));
|
||||||
#endif
|
|
||||||
|
|
||||||
m_actionOpenLinkNewTab->setText(tr("Open link in new tab"));
|
m_actionOpenLinkNewTab->setText(tr("Open link in new tab"));
|
||||||
m_actionOpenLinkNewTab->setToolTip(tr("Open this hyperlink in new tab."));
|
m_actionOpenLinkNewTab->setToolTip(tr("Open this hyperlink in new tab."));
|
||||||
|
@ -104,11 +104,7 @@ class WebView : public QWebEngineView {
|
|||||||
QAction *m_actionSavePageAs;
|
QAction *m_actionSavePageAs;
|
||||||
QAction *m_actionSaveHyperlinkAs;
|
QAction *m_actionSaveHyperlinkAs;
|
||||||
QAction *m_actionSaveImageAs;
|
QAction *m_actionSaveImageAs;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
QAction *m_actionCopyImageUrl;
|
QAction *m_actionCopyImageUrl;
|
||||||
#endif
|
|
||||||
|
|
||||||
QAction *m_actionOpenLinkThisTab;
|
QAction *m_actionOpenLinkThisTab;
|
||||||
QAction *m_actionOpenLinkNewTab;
|
QAction *m_actionOpenLinkNewTab;
|
||||||
QAction *m_actionOpenLinkExternally;
|
QAction *m_actionOpenLinkExternally;
|
||||||
|
@ -222,9 +222,7 @@ int Feed::updateMessages(const QList<Message> &messages) {
|
|||||||
QString new_message_url = QUrl(url()).toString(QUrl::RemoveUserInfo |
|
QString new_message_url = QUrl(url()).toString(QUrl::RemoveUserInfo |
|
||||||
QUrl::RemovePath |
|
QUrl::RemovePath |
|
||||||
QUrl::RemoveQuery |
|
QUrl::RemoveQuery |
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QUrl::RemoveFilename |
|
QUrl::RemoveFilename |
|
||||||
#endif
|
|
||||||
QUrl::StripTrailingSlash);
|
QUrl::StripTrailingSlash);
|
||||||
|
|
||||||
new_message_url += message.m_url;
|
new_message_url += message.m_url;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user