1
0
Fork 0
forked from lthn/blockchain

deeplinks: added click even forwarding on macos

This commit is contained in:
cryptozoidberg 2022-01-05 19:32:26 +01:00
parent 6c7ee2590d
commit 271e3eb99e
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 17 additions and 9 deletions

View file

@ -32,6 +32,7 @@ namespace bc_services
std::string payment_types; // []money accept type(bank transaction, internet money, cash, etc)
std::string deal_option; // []full amount, by parts
std::string category; // []
std::string preview_url; // []
uint8_t expiration_time; // n-days
//-----------------
@ -50,6 +51,7 @@ namespace bc_services
KV_SERIALIZE_N(deal_option, "do")
KV_SERIALIZE_N(category, "cat")
KV_SERIALIZE_N(expiration_time, "et")
KV_SERIALIZE_N(preview_url, "url")
END_KV_SERIALIZE_MAP()
};

View file

@ -7,9 +7,10 @@ bool URLEventFilter::eventFilter(QObject *obj, QEvent *event)
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event);
if(!fileEvent->url().isEmpty())
{
QMessageBox msg;
msg.setText(fileEvent->url().toString());
msg.exec();
m_pmainwindow->handle_deeplink_click(fileEvent->url());
//QMessageBox msg;
//msg.setText(fileEvent->url().toString());
//msg.exec();
}
} else {
// standard event processing

View file

@ -1,12 +1,17 @@
#include <QObject>
#include <QFileOpenEvent>
#include <QDebug>
#include "mainwindow.h"
class URLEventFilter : public QObject
{
Q_OBJECT
public:
URLEventFilter() : QObject(){};
URLEventFilter(MainWindow* pmainwindow) : m_pmainwindow(pmainwindow),QObject()
{};
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
MainWindow* m_pmainwindow;
};

View file

@ -66,11 +66,6 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
#ifdef Q_OS_DARWIN
URLEventFilter url_event_filter;
app.installEventFilter(&url_event_filter);
#endif
MainWindow viewer;
if (!viewer.init_backend(argc, argv))
@ -78,6 +73,11 @@ int main(int argc, char *argv[])
return 1;
}
#ifdef Q_OS_DARWIN
URLEventFilter url_event_filter(&viewer);
app.installEventFilter(&url_event_filter);
#endif
app.installNativeEventFilter(&viewer);
viewer.setWindowTitle(CURRENCY_NAME_BASE);
viewer.show_inital();