Added option to hide list headers.

This commit is contained in:
Martin Rotter 2014-03-28 13:02:02 +01:00
parent 46ae23fed6
commit 4bf4daa7eb
6 changed files with 41 additions and 7 deletions

View File

@ -10,7 +10,7 @@ Fixed:
Added:
<ul>
<li>Added option to hide main toolbars.</li>
<li>Added option to hide main toolbars and feed/message list headers.</li>
<li>"Defragment database" button shortcut is now changeable.</li>
<li>Added option to clear keyboard shortcuts.</li>
<li>Added "progress bar" to web browser.</li>

View File

@ -48,7 +48,7 @@ void ShortcutButton::keyPressEvent(QKeyEvent *event) {
}
Qt::KeyboardModifiers new_modifiers = event->modifiers() &
(Qt::SHIFT | Qt::CTRL | Qt::ALT | Qt::META);
(Qt::SHIFT | Qt::CTRL | Qt::ALT | Qt::META);
if (!m_catcher->m_isRecording && (pressed_key == Qt::Key_Return || pressed_key == Qt::Key_Space)) {
return;
@ -106,14 +106,14 @@ void ShortcutButton::keyReleaseEvent(QKeyEvent *event) {
return;
}
if (m_catcher->m_isRecording == false) {
if (!m_catcher->m_isRecording) {
return QPushButton::keyReleaseEvent(event);
}
event->accept();
Qt::KeyboardModifiers new_modifiers = event->modifiers() &
(Qt::SHIFT | Qt::CTRL | Qt::ALT | Qt::META);
(Qt::SHIFT | Qt::CTRL | Qt::ALT | Qt::META);
if (((uint) new_modifiers & m_catcher->m_modifierKeys) < m_catcher->m_modifierKeys) {
m_catcher->m_modifierKeys = new_modifiers;

View File

@ -50,6 +50,7 @@
FeedMessageViewer::FeedMessageViewer(QWidget *parent)
: TabContent(parent),
m_toolBarsEnabled(true),
m_listHeadersEnabled(true),
m_toolBarFeeds(new QToolBar(tr("Toolbar for feeds"), this)),
m_toolBarMessages(new QToolBar(tr("Toolbar for messages"), this)),
m_messagesView(new MessagesView(this)),
@ -99,8 +100,9 @@ void FeedMessageViewer::saveSize() {
width_column_date);
}
// Store "visibility" of toolbars.
// Store "visibility" of toolbars and list headers.
settings->setValue(APP_CFG_GUI, "enable_toolbars", m_toolBarsEnabled);
settings->setValue(APP_CFG_GUI, "enable_list_headers", m_listHeadersEnabled);
}
void FeedMessageViewer::loadSize() {
@ -142,6 +144,12 @@ void FeedMessageViewer::setToolBarsEnabled(bool enable) {
m_toolBarMessages->setVisible(enable);
}
void FeedMessageViewer::setListHeadersEnabled(bool enable) {
m_listHeadersEnabled = enable;
m_feedsView->header()->setVisible(enable);
m_messagesView->header()->setVisible(enable);
}
void FeedMessageViewer::updateTrayIconStatus(int unread_messages,
int total_messages) {
Q_UNUSED(total_messages)
@ -275,6 +283,8 @@ void FeedMessageViewer::createConnections() {
SIGNAL(triggered()), m_feedsView, SLOT(selectNextItem()));
connect(form_main->m_ui->m_actionSwitchToolBars,
SIGNAL(toggled(bool)), this, SLOT(setToolBarsEnabled(bool)));
connect(form_main->m_ui->m_actionSwitchListHeaders,
SIGNAL(toggled(bool)), this, SLOT(setListHeadersEnabled(bool)));
connect(form_main->m_ui->m_actionSelectPreviousFeedCategory,
SIGNAL(triggered()), m_feedsView, SLOT(selectPreviousItem()));
connect(form_main->m_ui->m_actionSelectNextMessage,

View File

@ -64,9 +64,14 @@ class FeedMessageViewer : public TabContent {
return m_toolBarsEnabled;
}
inline bool areListHeadersEnabled() const {
return m_listHeadersEnabled;
}
public slots:
// Enables/disables main toolbars.
// Enables/disables main toolbars or list headers.
void setToolBarsEnabled(bool enable);
void setListHeadersEnabled(bool enable);
// Runs "cleanup" of the database.
void vacuumDatabase();
@ -99,6 +104,7 @@ class FeedMessageViewer : public TabContent {
private:
bool m_toolBarsEnabled;
bool m_listHeadersEnabled;
QToolBar *m_toolBarFeeds;
QToolBar *m_toolBarMessages;

View File

@ -92,7 +92,8 @@ QList<QAction*> FormMain::allActions() {
actions << m_ui->m_actionSettings << m_ui->m_actionQuit <<
m_ui->m_actionFullscreen << m_ui->m_actionAboutGuard <<
m_ui->m_actionSwitchFeedsList << m_ui->m_actionSwitchMainWindow <<
m_ui->m_actionSwitchMainMenu << m_ui->m_actionSwitchToolBars;
m_ui->m_actionSwitchMainMenu << m_ui->m_actionSwitchToolBars <<
m_ui->m_actionSwitchListHeaders;
// Add web browser actions
actions << m_ui->m_actionAddBrowser << m_ui->m_actionCloseCurrentTab <<
@ -272,6 +273,7 @@ void FormMain::setupIcons() {
m_ui->m_actionSwitchFeedsList->setIcon(icon_theme_factory->fromTheme("view-switch-list"));
m_ui->m_actionSwitchMainMenu->setIcon(icon_theme_factory->fromTheme("view-switch-menu"));
m_ui->m_actionSwitchToolBars->setIcon(icon_theme_factory->fromTheme("view-switch-list"));
m_ui->m_actionSwitchListHeaders->setIcon(icon_theme_factory->fromTheme("view-switch-list"));
m_ui->m_menuShowHide->setIcon(icon_theme_factory->fromTheme("view-switch"));
// Web browser.
@ -341,6 +343,7 @@ void FormMain::loadSize() {
// Adjust dimensions of "feeds & messages" widget.
m_ui->m_tabWidget->feedMessageViewer()->loadSize();
m_ui->m_actionSwitchToolBars->setChecked(settings->value(APP_CFG_GUI, "enable_toolbars", true).toBool());
m_ui->m_actionSwitchListHeaders->setChecked(settings->value(APP_CFG_GUI, "enable_list_headers", true).toBool());
}
void FormMain::saveSize() {

View File

@ -77,6 +77,7 @@
<addaction name="m_actionSwitchFeedsList"/>
<addaction name="m_actionSwitchMainMenu"/>
<addaction name="m_actionSwitchToolBars"/>
<addaction name="m_actionSwitchListHeaders"/>
</widget>
<addaction name="m_menuShowHide"/>
<addaction name="m_actionSwitchMainWindow"/>
@ -515,6 +516,20 @@
<string notr="true">T</string>
</property>
</action>
<action name="m_actionSwitchListHeaders">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Feed/message list headers</string>
</property>
<property name="shortcut">
<string notr="true">H</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>