Merge branch 'master' of github.com:martinrotter/rssguard into master
This commit is contained in:
commit
abbeb9f968
@ -50,7 +50,7 @@ void LabelsMenu::keyPressEvent(QKeyEvent* event) {
|
||||
LabelAction* act = qobject_cast<LabelAction*>(activeAction());
|
||||
|
||||
if (act != nullptr && event->key() == Qt::Key::Key_Space) {
|
||||
act->toggle();
|
||||
act->toggleCheckState();
|
||||
}
|
||||
|
||||
NonClosableMenu::keyPressEvent(event);
|
||||
@ -60,10 +60,11 @@ void LabelsMenu::mousePressEvent(QMouseEvent* event) {
|
||||
LabelAction* act = qobject_cast<LabelAction*>(activeAction());
|
||||
|
||||
if (act != nullptr) {
|
||||
act->toggle();
|
||||
act->toggleCheckState();
|
||||
}
|
||||
else {
|
||||
NonClosableMenu::mousePressEvent(event);
|
||||
}
|
||||
|
||||
NonClosableMenu::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void LabelsMenu::changeLabelAssignment(Qt::CheckState state) {
|
||||
@ -121,7 +122,7 @@ Label* LabelAction::label() const {
|
||||
return m_label;
|
||||
}
|
||||
|
||||
void LabelAction::toggle() {
|
||||
void LabelAction::toggleCheckState() {
|
||||
if (m_checkState == Qt::CheckState::Unchecked) {
|
||||
setCheckState(Qt::CheckState::Checked);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class LabelAction : public QAction {
|
||||
Label* label() const;
|
||||
|
||||
public slots:
|
||||
void toggle();
|
||||
void toggleCheckState();
|
||||
|
||||
signals:
|
||||
void checkStateChanged(Qt::CheckState state);
|
||||
|
@ -15,7 +15,14 @@ void NonClosableMenu::keyPressEvent(QKeyEvent* event) {
|
||||
}
|
||||
|
||||
void NonClosableMenu::mousePressEvent(QMouseEvent* event) {
|
||||
Q_UNUSED(event)
|
||||
auto* act = dynamic_cast<QAction*>(activeAction());
|
||||
|
||||
if (act != nullptr) {
|
||||
act->toggle();
|
||||
}
|
||||
else {
|
||||
QMenu::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void NonClosableMenu::mouseReleaseEvent(QMouseEvent* event) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <QHeaderView>
|
||||
|
||||
TreeViewColumnsMenu::TreeViewColumnsMenu(QHeaderView* parent) : QMenu(parent) {
|
||||
TreeViewColumnsMenu::TreeViewColumnsMenu(QHeaderView* parent) : NonClosableMenu(parent) {
|
||||
connect(this, &TreeViewColumnsMenu::aboutToShow, this, &TreeViewColumnsMenu::prepareMenu);
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ void TreeViewColumnsMenu::prepareMenu() {
|
||||
act->setData(i);
|
||||
act->setCheckable(true);
|
||||
act->setChecked(!header_view->isSectionHidden(i));
|
||||
|
||||
connect(act, &QAction::toggled, this, &TreeViewColumnsMenu::actionTriggered);
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@
|
||||
#ifndef TREEVIEWCOLUMNSMENU_H
|
||||
#define TREEVIEWCOLUMNSMENU_H
|
||||
|
||||
#include <QMenu>
|
||||
#include "gui/nonclosablemenu.h"
|
||||
|
||||
class QHeaderView;
|
||||
|
||||
class TreeViewColumnsMenu : public QMenu {
|
||||
class TreeViewColumnsMenu : public NonClosableMenu {
|
||||
public:
|
||||
explicit TreeViewColumnsMenu(QHeaderView* parent);
|
||||
|
||||
|
@ -1130,13 +1130,13 @@ bool DatabaseQueries::deleteAccount(const QSqlDatabase& db, int account_id) {
|
||||
query.setForwardOnly(true);
|
||||
QStringList queries;
|
||||
|
||||
queries << QSL("DELETE FROM Messages WHERE account_id = :account_id;")
|
||||
queries << QSL("DELETE FROM MessageFiltersInFeeds WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM LabelsInMessages WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM Messages WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM Feeds WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM Categories WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM MessageFiltersInFeeds WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM Accounts WHERE id = :account_id;")
|
||||
<< QSL("DELETE FROM LabelsInMessages WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM Labels WHERE account_id = :account_id;");
|
||||
<< QSL("DELETE FROM Labels WHERE account_id = :account_id;")
|
||||
<< QSL("DELETE FROM Accounts WHERE id = :account_id;");
|
||||
|
||||
for (const QString& q : queries) {
|
||||
query.prepare(q);
|
||||
|
Loading…
x
Reference in New Issue
Block a user