better logic when handling text for google search
This commit is contained in:
parent
6e0fe00d8d
commit
749138e7c4
@ -32,6 +32,10 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
|
|||||||
&PlainToolButton::setEnabled);
|
&PlainToolButton::setEnabled);
|
||||||
connect(m_ui.m_btnNextPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::nextPage);
|
connect(m_ui.m_btnNextPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::nextPage);
|
||||||
connect(m_ui.m_btnPreviousPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::previousPage);
|
connect(m_ui.m_btnPreviousPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::previousPage);
|
||||||
|
connect(m_ui.m_treeArticles,
|
||||||
|
&QAbstractItemView::doubleClicked,
|
||||||
|
this,
|
||||||
|
&ArticleListNotification::openArticleInWebBrowser);
|
||||||
connect(m_ui.m_btnOpenWebBrowser, &PlainToolButton::clicked, this, &ArticleListNotification::openArticleInWebBrowser);
|
connect(m_ui.m_btnOpenWebBrowser, &PlainToolButton::clicked, this, &ArticleListNotification::openArticleInWebBrowser);
|
||||||
connect(m_ui.m_btnOpenArticleList,
|
connect(m_ui.m_btnOpenArticleList,
|
||||||
&PlainToolButton::clicked,
|
&PlainToolButton::clicked,
|
||||||
|
@ -71,8 +71,7 @@ void ToastNotificationsManager::showNotification(Notification::Event event,
|
|||||||
|
|
||||||
if (!msg.m_feedFetchResults.updatedFeeds().isEmpty()) {
|
if (!msg.m_feedFetchResults.updatedFeeds().isEmpty()) {
|
||||||
if (m_articleListNotification == nullptr) {
|
if (m_articleListNotification == nullptr) {
|
||||||
m_articleListNotification = new ArticleListNotification();
|
initializeArticleListNotification();
|
||||||
hookNotification(m_articleListNotification);
|
|
||||||
}
|
}
|
||||||
else if (m_activeNotifications.contains(m_articleListNotification)) {
|
else if (m_activeNotifications.contains(m_articleListNotification)) {
|
||||||
// Article notification is somewhere in list, clear first to move it to first positon.
|
// Article notification is somewhere in list, clear first to move it to first positon.
|
||||||
@ -110,6 +109,8 @@ void ToastNotificationsManager::showNotification(Notification::Event event,
|
|||||||
m_activeNotifications.prepend(notif);
|
m_activeNotifications.prepend(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToastNotificationsManager::openArticleInArticleList(Feed* feed, const Message& msg) {}
|
||||||
|
|
||||||
void ToastNotificationsManager::closeNotification(BaseToastNotification* notif, bool delete_from_memory) {
|
void ToastNotificationsManager::closeNotification(BaseToastNotification* notif, bool delete_from_memory) {
|
||||||
auto notif_idx = m_activeNotifications.indexOf(notif);
|
auto notif_idx = m_activeNotifications.indexOf(notif);
|
||||||
|
|
||||||
@ -159,6 +160,17 @@ QPoint ToastNotificationsManager::cornerForNewNotification(QRect screen_rect) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToastNotificationsManager::initializeArticleListNotification() {
|
||||||
|
m_articleListNotification = new ArticleListNotification();
|
||||||
|
hookNotification(m_articleListNotification);
|
||||||
|
|
||||||
|
/*
|
||||||
|
connect(m_articleListNotification,
|
||||||
|
&ArticleListNotification::openingArticleInArticleListRequested,
|
||||||
|
this,
|
||||||
|
&ArticleListNotification::)*/
|
||||||
|
}
|
||||||
|
|
||||||
void ToastNotificationsManager::hookNotification(BaseToastNotification* notif) {
|
void ToastNotificationsManager::hookNotification(BaseToastNotification* notif) {
|
||||||
connect(notif, &BaseToastNotification::closeRequested, this, [this](BaseToastNotification* notif) {
|
connect(notif, &BaseToastNotification::closeRequested, this, [this](BaseToastNotification* notif) {
|
||||||
closeNotification(notif, notif != m_articleListNotification);
|
closeNotification(notif, notif != m_articleListNotification);
|
||||||
|
@ -47,6 +47,7 @@ class ToastNotificationsManager : public QObject {
|
|||||||
void showNotification(Notification::Event event, const GuiMessage& msg, const GuiAction& action);
|
void showNotification(Notification::Event event, const GuiMessage& msg, const GuiAction& action);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void openArticleInArticleList(Feed* feed, const Message& msg);
|
||||||
void closeNotification(BaseToastNotification* notif, bool delete_from_memory);
|
void closeNotification(BaseToastNotification* notif, bool delete_from_memory);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -54,6 +55,7 @@ class ToastNotificationsManager : public QObject {
|
|||||||
QScreen* moveToProperScreen(BaseToastNotification* notif);
|
QScreen* moveToProperScreen(BaseToastNotification* notif);
|
||||||
QPoint cornerForNewNotification(QRect screen_rect);
|
QPoint cornerForNewNotification(QRect screen_rect);
|
||||||
|
|
||||||
|
void initializeArticleListNotification();
|
||||||
void hookNotification(BaseToastNotification* notif);
|
void hookNotification(BaseToastNotification* notif);
|
||||||
void moveNotificationToCorner(BaseToastNotification* notif, QPoint corner);
|
void moveNotificationToCorner(BaseToastNotification* notif, QPoint corner);
|
||||||
void makeSpaceForNotification(int height_to_make_space, bool reverse = false, int stard_idx = 0);
|
void makeSpaceForNotification(int height_to_make_space, bool reverse = false, int stard_idx = 0);
|
||||||
|
@ -150,7 +150,12 @@ void GoogleSuggest::preventSuggest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GoogleSuggest::autoSuggest() {
|
void GoogleSuggest::autoSuggest() {
|
||||||
QUrl entered_url = QUrl::fromUserInput(m_editor->text());
|
QUrl entered_url = QUrl(m_editor->text());
|
||||||
|
|
||||||
|
// auto a = entered_url.isValid();
|
||||||
|
// auto b = entered_url.isLocalFile();
|
||||||
|
// auto c = entered_url.scheme();
|
||||||
|
// auto d = entered_url.host();
|
||||||
|
|
||||||
if (m_editor->text().size() < 3 || m_editor->text().startsWith(QSL("http")) ||
|
if (m_editor->text().size() < 3 || m_editor->text().startsWith(QSL("http")) ||
|
||||||
m_editor->text().startsWith(QSL("www")) ||
|
m_editor->text().startsWith(QSL("www")) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user