Changeeees.

This commit is contained in:
Martin Rotter 2013-11-24 14:44:17 +01:00
parent db5274da66
commit f59c09b356
6 changed files with 123 additions and 13 deletions

View File

@ -4,6 +4,9 @@
#include <QApplication>
#include <QLineEdit>
#include <QAction>
#include <QToolButton>
#include <QMenu>
#include <QWidgetAction>
#include "gui/feedmessageviewer.h"
#include "gui/webbrowser.h"
@ -34,10 +37,25 @@ void FeedMessageViewer::initialize() {
m_toolBar->setAllowedAreas(Qt::TopToolBarArea);
// TODO: testovaci
QMenu *update_menu = new QMenu(m_toolBar);
QAction *testAction = new QAction("test menu item", this);
update_menu->addAction(testAction);
QToolButton* toolButton = new QToolButton();
toolButton->setMenu(update_menu);
toolButton->setIcon(QIcon::fromTheme("application-exit"));
toolButton->setText("aaa");
toolButton->setPopupMode(QToolButton::MenuButtonPopup);
QWidgetAction* toolButtonAction = new QWidgetAction(this);
toolButtonAction->setDefaultWidget(toolButton);
m_toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_toolBar->addAction(toolButtonAction);
m_toolBar->addAction(QIcon::fromTheme("application-exit"), "aaa");
QAction *ac = m_toolBar->actions().at(0);
connect(ac, SIGNAL(triggered()),
m_messagesView->model()->sourceModel(), SLOT(submitAll()));
m_messagesView, SLOT(setAllMessagesRead()));
// Finish web/message browser setup.
m_messagesBrowser->setNavigationBarVisible(false);

View File

@ -29,6 +29,7 @@ class FeedMessageViewer : public TabContent {
private:
QToolBar *m_toolBar;
MessagesView *m_messagesView;
FeedsView *m_feedsView;
WebBrowser *m_messagesBrowser;

View File

@ -148,6 +148,8 @@ void FormMain::setupIcons() {
m_ui->m_actionImport->setIcon(IconThemeFactory::getInstance()->fromTheme("document-import"));
m_ui->m_actionExport->setIcon(IconThemeFactory::getInstance()->fromTheme("document-export"));
m_ui->m_actionFullscreen->setIcon(IconThemeFactory::getInstance()->fromTheme("view-fullscreen"));
m_ui->m_actionUpdateAll->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh"));
m_ui->m_actionUpdateSelected->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh"));
// Setup icons for underlying components: opened web browsers...
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {

View File

@ -48,7 +48,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>19</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="m_menuFile">
@ -93,8 +93,28 @@
<addaction name="separator"/>
<addaction name="m_menuCurrentTab"/>
</widget>
<widget class="QMenu" name="m_menuFeeds">
<property name="title">
<string>Fee&amp;ds</string>
</property>
<addaction name="m_actionUpdateAll"/>
<addaction name="m_actionUpdateSelected"/>
<addaction name="separator"/>
<addaction name="m_actionEditSelected"/>
<addaction name="m_actionDeleteSelected"/>
</widget>
<widget class="QMenu" name="m_menuMessages">
<property name="title">
<string>&amp;Messages</string>
</property>
<addaction name="actionMark_selected_as_read"/>
<addaction name="actionMark_selected_as_unread"/>
<addaction name="actionSwitch_importance"/>
</widget>
<addaction name="m_menuFile"/>
<addaction name="m_menuView"/>
<addaction name="m_menuFeeds"/>
<addaction name="m_menuMessages"/>
<addaction name="m_menuWebBrowser"/>
<addaction name="m_menuTools"/>
<addaction name="m_menuHelp"/>
@ -195,6 +215,62 @@
<string notr="true"/>
</property>
</action>
<action name="m_actionUpdateAll">
<property name="text">
<string>Update &amp;all</string>
</property>
<property name="toolTip">
<string>Update all feeds.</string>
</property>
</action>
<action name="m_actionUpdateSelected">
<property name="text">
<string>Update &amp;selected</string>
</property>
<property name="toolTip">
<string>Update selected feeds/categories.</string>
</property>
</action>
<action name="m_actionEditSelected">
<property name="text">
<string>&amp;Edit selected</string>
</property>
<property name="toolTip">
<string>Edit selected feed/category.</string>
</property>
</action>
<action name="m_actionDeleteSelected">
<property name="text">
<string>&amp;Delete selected</string>
</property>
<property name="toolTip">
<string>Delete selected feeds/categories.</string>
</property>
</action>
<action name="actionMark_selected_as_read">
<property name="text">
<string>Mark as &amp;read</string>
</property>
<property name="toolTip">
<string>Mark selected messages as read.</string>
</property>
</action>
<action name="actionMark_selected_as_unread">
<property name="text">
<string>Mark as &amp;unread</string>
</property>
<property name="toolTip">
<string>Mark selected messages as unread.</string>
</property>
</action>
<action name="actionSwitch_importance">
<property name="text">
<string>Switch importance</string>
</property>
<property name="toolTip">
<string>Switch importance of selected messages.</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -82,16 +82,30 @@ void MessagesView::keyPressEvent(QKeyEvent *event) {
void MessagesView::currentChanged(const QModelIndex &current,
const QModelIndex &previous) {
QModelIndex ind = m_proxyModel->mapToSource(current);
QModelIndex mapped_current = m_proxyModel->mapToSource(current);
qDebug("CurrentChanged %d %d source %d %d",
qDebug("Current row changed, row [%d,%d] source %d %d",
current.row(), current.column(),
ind.row(), ind.column());
mapped_current.row(), mapped_current.column());
m_sourceModel->setMessageRead(ind.row(), 1);
emit currentMessageChanged(m_sourceModel->messageAt(ind.row()));
m_sourceModel->setMessageRead(mapped_current.row(), 1);
emit currentMessageChanged(m_sourceModel->messageAt(mapped_current.row()));
QTreeView::currentChanged(current, previous);
}
void MessagesView::setSelectedMessagesReadStatus(int read) {
}
void MessagesView::setAllMessagesRead() {
selectAll();
QModelIndexList selected_indexes = selectedIndexes();
QModelIndexList mapp;
foreach (const QModelIndex &index, selected_indexes) {
mapp << m_proxyModel->mapToSource(index);
}
m_sourceModel->switchBatchMessageImportance(mapp);
}

View File

@ -24,11 +24,10 @@ class MessagesView : public QTreeView {
public slots:
// Message manipulators.
// TODO: sem pridat metody jako
// setSelectedMessagesRead....
// setSelectedMessagesUnread.....
// deleteSelectedMessages....
// ......
void setSelectedMessagesReadStatus(int read);
void setAllMessagesRead();
protected:
void setupAppearance();