1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Fix compilation with QByteArray

And a few port away from deprecated APIs
This commit is contained in:
Carl Schwan 2023-11-22 01:24:10 +01:00
parent 845c241f21
commit caf37cec4e
No known key found for this signature in database
GPG Key ID: 02325448204E452A
4 changed files with 15 additions and 13 deletions

View File

@ -45,6 +45,8 @@
extern void qt_mac_set_dock_menu(QMenu* menu); extern void qt_mac_set_dock_menu(QMenu* menu);
#endif #endif
using namespace Qt::Literals::StringLiterals;
MainMenu::MainMenu(BrowserWindow* window, QWidget* parent) MainMenu::MainMenu(BrowserWindow* window, QWidget* parent)
: QMenu(parent) : QMenu(parent)
, m_window(window) , m_window(window)
@ -177,7 +179,7 @@ void MainMenu::savePageAs()
void MainMenu::sendLink() void MainMenu::sendLink()
{ {
const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(QString::fromUtf8(m_window->weView()->url().toEncoded())) + "&subject=" + QUrl::toPercentEncoding(m_window->weView()->title())); const QUrl mailUrl = QUrl::fromEncoded(QByteArray("mailto:%20?body="_ba + QUrl::toPercentEncoding(QString::fromUtf8(m_window->weView()->url().toEncoded())) + "&subject="_ba + QUrl::toPercentEncoding(m_window->weView()->title())));
QDesktopServices::openUrl(mailUrl); QDesktopServices::openUrl(mailUrl);
} }

View File

@ -157,5 +157,5 @@ void Updater::downCompleted()
void Updater::downloadNewVersion() void Updater::downloadNewVersion()
{ {
m_window->tabWidget()->addView(QUrl::fromEncoded(QByteArray(Qz::WWWADDRESS) + QByteArray("/download")), tr("Update"), Qz::NT_NotSelectedTab); m_window->tabWidget()->addView(QUrl::fromEncoded(QByteArray(QByteArray(Qz::WWWADDRESS) + QByteArray("/download"))), tr("Update"), Qz::NT_NotSelectedTab);
} }

View File

@ -45,7 +45,7 @@ QPoint QmlMouseEvent::globalPos() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return QPoint(-1, -1); return QPoint(-1, -1);
} }
return m_mouseEvent->globalPos(); return m_mouseEvent->globalPosition().toPoint();
} }
int QmlMouseEvent::globalX() const int QmlMouseEvent::globalX() const
@ -53,7 +53,7 @@ int QmlMouseEvent::globalX() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return -1; return -1;
} }
return m_mouseEvent->globalX(); return m_mouseEvent->globalPosition().x();
} }
int QmlMouseEvent::globalY() const int QmlMouseEvent::globalY() const
@ -61,7 +61,7 @@ int QmlMouseEvent::globalY() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return -1; return -1;
} }
return m_mouseEvent->globalY(); return m_mouseEvent->globalPosition().y();
} }
QPointF QmlMouseEvent::localPos() const QPointF QmlMouseEvent::localPos() const
@ -69,7 +69,7 @@ QPointF QmlMouseEvent::localPos() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return QPointF(-1, -1); return QPointF(-1, -1);
} }
return m_mouseEvent->localPos(); return m_mouseEvent->position();
} }
QPoint QmlMouseEvent::pos() const QPoint QmlMouseEvent::pos() const
@ -85,7 +85,7 @@ QPointF QmlMouseEvent::screenPos() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return QPointF(-1, -1); return QPointF(-1, -1);
} }
return m_mouseEvent->screenPos(); return m_mouseEvent->globalPosition();
} }
int QmlMouseEvent::source() const int QmlMouseEvent::source() const
@ -101,7 +101,7 @@ QPointF QmlMouseEvent::windowPos() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return QPointF(-1, -1); return QPointF(-1, -1);
} }
return m_mouseEvent->windowPos(); return m_mouseEvent->scenePosition();
} }
int QmlMouseEvent::x() const int QmlMouseEvent::x() const
@ -109,7 +109,7 @@ int QmlMouseEvent::x() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return -1; return -1;
} }
return m_mouseEvent->x(); return m_mouseEvent->position().x();
} }
int QmlMouseEvent::y() const int QmlMouseEvent::y() const
@ -117,7 +117,7 @@ int QmlMouseEvent::y() const
if (!m_mouseEvent) { if (!m_mouseEvent) {
return -1; return -1;
} }
return m_mouseEvent->y(); return m_mouseEvent->position().y();
} }
void QmlMouseEvent::clear() void QmlMouseEvent::clear()

View File

@ -475,14 +475,14 @@ void WebView::openUrlInNewWindow()
void WebView::sendTextByMail() void WebView::sendTextByMail()
{ {
if (auto* action = qobject_cast<QAction*>(sender())) { if (auto* action = qobject_cast<QAction*>(sender())) {
const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(action->data().toString())); const QUrl mailUrl = QUrl::fromEncoded(QByteArray("mailto:%20?body=" + QUrl::toPercentEncoding(action->data().toString())));
QDesktopServices::openUrl(mailUrl); QDesktopServices::openUrl(mailUrl);
} }
} }
void WebView::sendPageByMail() void WebView::sendPageByMail()
{ {
const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(QString::fromUtf8(url().toEncoded())) + "&subject=" + QUrl::toPercentEncoding(title())); const QUrl mailUrl = QUrl::fromEncoded(QByteArray("mailto:%20?body=" + QUrl::toPercentEncoding(QString::fromUtf8(url().toEncoded())) + "&subject=" + QUrl::toPercentEncoding(title())));
QDesktopServices::openUrl(mailUrl); QDesktopServices::openUrl(mailUrl);
} }
@ -1136,7 +1136,7 @@ void WebView::_mouseReleaseEvent(QMouseEvent *event)
case Qt::RightButton: case Qt::RightButton:
if (s_forceContextMenuOnMouseRelease) { if (s_forceContextMenuOnMouseRelease) {
QContextMenuEvent ev(QContextMenuEvent::Mouse, event->pos(), event->globalPos(), event->modifiers()); QContextMenuEvent ev(QContextMenuEvent::Mouse, event->pos(), event->globalPosition().toPoint(), event->modifiers());
_contextMenuEvent(&ev); _contextMenuEvent(&ev);
event->accept(); event->accept();
} }