Work on web engine. It SUXX. I will abandon internal web browser completely. User would have to rely on external web browser setup.
This commit is contained in:
parent
b87efa1cf0
commit
3682c20611
@ -70,13 +70,10 @@ QModelIndex MessagesProxyModel::getNextUnreadItemIndex(int default_row, int max_
|
||||
}
|
||||
|
||||
bool MessagesProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const {
|
||||
// FIXME: V případě hodně položke je to pomalé.
|
||||
// V případě, že do messagelistu budu zobrazovat řekněme
|
||||
// více než 4 000 zpráv, tak tady vracet automaticky false,
|
||||
// neprovádět skutečně porovnávání.
|
||||
Q_UNUSED(left)
|
||||
Q_UNUSED(right)
|
||||
|
||||
// NOTE: Porovnání se provádí již při dotazu v databázi, netřeba řešit zde.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <QTranslator>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QWebEngineProfile>
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@ -96,7 +97,7 @@ int main(int argc, char *argv[]) {
|
||||
main_window.setWindowTitle(APP_LONG_NAME);
|
||||
|
||||
// Now is a good time to initialize dynamic keyboard shortcuts.
|
||||
DynamicShortcuts::load(qApp->userActions());
|
||||
DynamicShortcuts::load(qApp->userActions());
|
||||
|
||||
// Display main window.
|
||||
if (qApp->settings()->value(GROUP(GUI), SETTING(GUI::MainWindowStartsHidden)).toBool() && SystemTrayIcon::isSystemTrayActivated()) {
|
||||
@ -133,6 +134,8 @@ int main(int argc, char *argv[]) {
|
||||
QTimer::singleShot(STARTUP_UPDATE_DELAY, application.system(), SLOT(checkForUpdatesOnStartup()));
|
||||
}
|
||||
|
||||
QObject::connect(QWebEngineProfile::defaultProfile(), SIGNAL(downloadRequested(QWebEngineDownloadItem*)),
|
||||
qApp->downloadManager(), SLOT(download(QWebEngineDownloadItem*)));
|
||||
|
||||
// Enter global event loop.
|
||||
return Application::exec();
|
||||
|
@ -131,15 +131,15 @@ class Application : public QtSingleApplication {
|
||||
}
|
||||
|
||||
inline QString tempFolderPath() {
|
||||
return IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::TempLocation);
|
||||
return IOFactory::getSystemFolder(QStandardPaths::TempLocation);
|
||||
}
|
||||
|
||||
inline QString documentsFolderPath() {
|
||||
return IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::DocumentsLocation);
|
||||
return IOFactory::getSystemFolder(QStandardPaths::DocumentsLocation);
|
||||
}
|
||||
|
||||
inline QString homeFolderPath() {
|
||||
return IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::HomeLocation);
|
||||
return IOFactory::getSystemFolder(QStandardPaths::HomeLocation);
|
||||
}
|
||||
|
||||
void backupDatabaseSettings(bool backup_database, bool backup_settings,
|
||||
|
@ -30,8 +30,8 @@
|
||||
IOFactory::IOFactory() {
|
||||
}
|
||||
|
||||
QString IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::StandardLocation location) {
|
||||
return SYSTEM_FOLDER_ENUM::writableLocation(location);
|
||||
QString IOFactory::getSystemFolder(QStandardPaths::StandardLocation location) {
|
||||
return QStandardPaths::writableLocation(location);
|
||||
}
|
||||
|
||||
QString IOFactory::ensureUniqueFilename(const QString &name, const QString &append_format) {
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "definitions/definitions.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
#define SYSTEM_FOLDER_ENUM QStandardPaths
|
||||
|
||||
|
||||
class IOFactory {
|
||||
@ -34,7 +33,7 @@ class IOFactory {
|
||||
|
||||
public:
|
||||
// Returns system-wide folder according to type.
|
||||
static QString getSystemFolder(SYSTEM_FOLDER_ENUM::StandardLocation location);
|
||||
static QString getSystemFolder(QStandardPaths::StandardLocation location);
|
||||
|
||||
// Checks given file if it exists and if it does, then generates non-existing new file
|
||||
// according to format.
|
||||
|
@ -181,13 +181,13 @@ DKEY Downloads::AlwaysPromptForFilename = "prompt_for_filename";
|
||||
DVALUE(bool) Downloads::AlwaysPromptForFilenameDef = false;
|
||||
|
||||
DKEY Downloads::TargetDirectory = "target_directory";
|
||||
DVALUE(QString) Downloads::TargetDirectoryDef = IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::DesktopLocation);
|
||||
DVALUE(QString) Downloads::TargetDirectoryDef = IOFactory::getSystemFolder(QStandardPaths::DesktopLocation);
|
||||
|
||||
DKEY Downloads::RemovePolicy = "remove_policy";
|
||||
DVALUE(int) Downloads::RemovePolicyDef = DownloadManager::Never;
|
||||
|
||||
DKEY Downloads::TargetExplicitDirectory = "target_explicit_directory";
|
||||
DVALUE(QString) Downloads::TargetExplicitDirectoryDef = IOFactory::getSystemFolder(SYSTEM_FOLDER_ENUM::DesktopLocation);
|
||||
DVALUE(QString) Downloads::TargetExplicitDirectoryDef = IOFactory::getSystemFolder(QStandardPaths::DesktopLocation);
|
||||
|
||||
DKEY Downloads::ShowDownloadsWhenNewDownloadStarts = "show_downloads_on_new_download_start";
|
||||
DVALUE(bool) Downloads::ShowDownloadsWhenNewDownloadStartsDef = true;
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QWebEngineSettings>
|
||||
#include <QWebEngineDownloadItem>
|
||||
|
||||
|
||||
DownloadItem::DownloadItem(bool is_direct_download, QNetworkReply *reply, QWidget *parent) : QWidget(parent),
|
||||
@ -512,6 +513,10 @@ void DownloadManager::download(const QUrl &url, bool direct_download) {
|
||||
download(QNetworkRequest(url), direct_download);
|
||||
}
|
||||
|
||||
void DownloadManager::download(QWebEngineDownloadItem *down) {
|
||||
download(down->url(), true);
|
||||
}
|
||||
|
||||
void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool direct_download) {
|
||||
if (reply == NULL || reply->url().isEmpty()) {
|
||||
return;
|
||||
|
@ -32,6 +32,7 @@ class AutoSaver;
|
||||
class DownloadModel;
|
||||
class QFileIconProvider;
|
||||
class QMimeData;
|
||||
class QWebEngineDownloadItem;
|
||||
|
||||
class DownloadItem : public QWidget {
|
||||
Q_OBJECT
|
||||
@ -127,6 +128,7 @@ class DownloadManager : public TabContent {
|
||||
public slots:
|
||||
void download(const QNetworkRequest &request, bool direct_download = false);
|
||||
void download(const QUrl &url, bool direct_download = false);
|
||||
void download(QWebEngineDownloadItem *down);
|
||||
void handleUnsupportedContent(QNetworkReply *reply, bool direct_download = false);
|
||||
void cleanup();
|
||||
|
||||
|
@ -136,10 +136,6 @@ void WebView::saveCurrentPageToFile() {
|
||||
}
|
||||
|
||||
void WebView::createConnections() {
|
||||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(popupContextMenu(QPoint)));
|
||||
connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadLink(QNetworkRequest)));
|
||||
|
||||
connect(m_actionSavePageAs, SIGNAL(triggered()), this, SLOT(saveCurrentPageToFile()));
|
||||
connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(printCurrentPage()));
|
||||
connect(m_actionOpenLinkNewTab, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()));
|
||||
@ -232,10 +228,6 @@ void WebView::printCurrentPage() {
|
||||
print_preview.data()->exec();
|
||||
}
|
||||
|
||||
void WebView::downloadLink(const QNetworkRequest &request) {
|
||||
qApp->downloadManager()->download(request);
|
||||
}
|
||||
|
||||
void WebView::mousePressEvent(QMouseEvent *event) {
|
||||
if (event->button() & Qt::MiddleButton) {
|
||||
m_gestureOrigin = event->pos();
|
||||
|
@ -65,9 +65,6 @@ class WebView : public QWebEngineView {
|
||||
void saveCurrentPageToFile();
|
||||
void printCurrentPage();
|
||||
|
||||
private slots:
|
||||
void downloadLink(const QNetworkRequest &request);
|
||||
|
||||
protected:
|
||||
// Initializes all actions.
|
||||
void initializeActions();
|
||||
|
Loading…
x
Reference in New Issue
Block a user