All messages marked read when opened externally/newspaper + added initial dialog for adding/editing standard feeds.

This commit is contained in:
Martin Rotter 2014-01-29 12:26:50 +01:00
parent 0ba0e2fc18
commit 5338d2d212
15 changed files with 189 additions and 22 deletions

View File

@ -288,6 +288,7 @@ set(APP_SOURCES
src/gui/statusbar.cpp
src/gui/iconfactory.cpp
src/gui/formstandardcategorydetails.cpp
src/gui/formstandardfeeddetails.cpp
src/gui/plaintoolbutton.cpp
src/gui/lineeditwithstatus.cpp
src/gui/messagebox.cpp
@ -353,6 +354,7 @@ set(APP_HEADERS
src/gui/messagesview.h
src/gui/statusbar.h
src/gui/formstandardcategorydetails.h
src/gui/formstandardfeeddetails.h
src/gui/plaintoolbutton.h
src/gui/lineeditwithstatus.h
src/gui/messagebox.h
@ -379,6 +381,7 @@ set(APP_FORMS
src/gui/formwelcome.ui
src/gui/formabout.ui
src/gui/formstandardcategorydetails.ui
src/gui/formstandardfeeddetails.ui
)
# Add translations.

View File

@ -239,16 +239,12 @@ void FeedMessageViewer::initialize() {
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkAllFeedsRead);
m_toolBar->addSeparator();
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionUpdateSelectedFeedsCategories);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionAddNewFeed);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionEditSelectedFeedCategory);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionDeleteSelectedFeedCategory);
m_toolBar->addSeparator();
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkFeedsAsRead);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkFeedsAsUnread);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionClearFeeds);
m_toolBar->addSeparator();
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsRead);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsUnread);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionDeleteSelectedMessages);
// Finish web/message browser setup.
m_messagesBrowser->setNavigationBarVisible(false);

View File

@ -250,6 +250,7 @@ void FeedsView::openSelectedFeedsInNewspaperMode() {
if (!messages.isEmpty()) {
emit openMessagesInNewspaperView(messages);
markSelectedFeedsRead();
}
}

View File

@ -2,6 +2,9 @@
#include "core/textfactory.h"
#include "gui/iconthemefactory.h"
#if !defined(Q_OS_WIN)
#include "gui/messagebox.h"
#endif
#include <QFile>
#include <QTextStream>
@ -13,6 +16,11 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("help-about"));
#if !defined(Q_OS_WIN)
MessageBox::iconify(m_ui->m_buttonBox);
#endif
m_ui->m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH));
// Load information from embedded text files.

View File

@ -55,10 +55,6 @@ FormMain *FormMain::instance() {
return s_instance;
}
QList<QAction*> FormMain::allActions() {
QList<QAction*> actions;
@ -224,7 +220,7 @@ void FormMain::setupIcons() {
m_ui->m_actionDeleteSelectedFeedCategory->setIcon(IconThemeFactory::instance()->fromTheme("edit-delete"));
m_ui->m_actionDeleteSelectedMessages->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-junk"));
m_ui->m_actionAddStandardCategory->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
m_ui->m_actionAddNewFeed->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
m_ui->m_actionAddStandardFeed->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
m_ui->m_actionEditSelectedFeedCategory->setIcon(IconThemeFactory::instance()->fromTheme("gnome-other"));
m_ui->m_actionMarkAllFeedsRead->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-not-junk"));
m_ui->m_actionMarkFeedsAsRead->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-not-junk"));

View File

@ -97,7 +97,7 @@
<addaction name="m_actionUpdateAllFeeds"/>
<addaction name="m_actionUpdateSelectedFeedsCategories"/>
<addaction name="separator"/>
<addaction name="m_actionAddNewFeed"/>
<addaction name="m_actionAddStandardFeed"/>
<addaction name="m_actionAddStandardCategory"/>
<addaction name="m_actionEditSelectedFeedCategory"/>
<addaction name="m_actionDeleteSelectedFeedCategory"/>
@ -324,16 +324,13 @@
<string>Remove all messages from selected feeds.</string>
</property>
</action>
<action name="m_actionAddNewFeed">
<action name="m_actionAddStandardFeed">
<property name="text">
<string>Add new &amp;feed</string>
<string>Add new standard &amp;feed</string>
</property>
<property name="toolTip">
<string>Add new feed.</string>
</property>
<property name="shortcut">
<string notr="true"/>
</property>
</action>
<action name="m_actionOpenSelectedSourceArticlesExternally">
<property name="text">

View File

@ -30,6 +30,10 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("preferences-system"));
#if !defined(Q_OS_WIN)
MessageBox::iconify(m_ui->m_buttonBox);
#endif
// Setup behavior.
m_ui->m_treeLanguages->setColumnCount(5);
m_ui->m_treeLanguages->setHeaderHidden(false);

View File

@ -8,7 +8,10 @@
#include "gui/iconthemefactory.h"
#include "gui/feedsview.h"
#include "gui/baselineedit.h"
#if !defined(Q_OS_WIN)
#include "gui/messagebox.h"
#endif
#include <QLineEdit>
#include <QTextEdit>
@ -65,6 +68,10 @@ int FormStandardCategoryDetails::exec(FeedsModelStandardCategory *input_category
if (input_category == NULL) {
// User is adding new category.
setWindowTitle(tr("Add new category"));
// Make sure that "default" icon is used as the default option for new
// categories.
m_actionUseDefaultIcon->trigger();
}
else {
// User is editing existing category.
@ -122,8 +129,8 @@ void FormStandardCategoryDetails::onTitleChanged(const QString &new_title){
}
void FormStandardCategoryDetails::onDescriptionChanged(const QString &new_description) {
if (new_description.isEmpty()) {
m_ui->m_txtDescription->setStatus(LineEditWithStatus::Warning, tr("Please, enter some description."));
if (new_description.simplified().isEmpty()) {
m_ui->m_txtDescription->setStatus(LineEditWithStatus::Warning, tr("Description is empty."));
}
else {
m_ui->m_txtDescription->setStatus(LineEditWithStatus::Ok, tr("The description os ok."));
@ -160,6 +167,13 @@ void FormStandardCategoryDetails::initialize() {
m_ui = new Ui::FormStandardCategoryDetails();
m_ui->setupUi(this);
// Set text boxes.
m_ui->m_txtTitle->lineEdit()->setPlaceholderText(tr("Category title"));
m_ui->m_txtTitle->lineEdit()->setToolTip(tr("Set title for your category."));
m_ui->m_txtDescription->lineEdit()->setPlaceholderText(tr("Category description"));
m_ui->m_txtDescription->lineEdit()->setToolTip(tr("Set description for your category."));
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("document-new"));
@ -177,7 +191,7 @@ void FormStandardCategoryDetails::initialize() {
tr("Load icon from file..."),
this);
m_actionNoIcon = new QAction(IconThemeFactory::instance()->fromTheme("edit-delete"),
tr("No icon"),
tr("Do not use icon"),
this);
m_actionUseDefaultIcon = new QAction(IconThemeFactory::instance()->fromTheme("folder-black"),
tr("Use default icon"),

View File

@ -36,13 +36,20 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_cmbParentCategory"/>
<widget class="QComboBox" name="m_cmbParentCategory">
<property name="toolTip">
<string>Select parent item for your category.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_lblTitle">
<property name="text">
<string>Title</string>
</property>
<property name="buddy">
<cstring>m_txtTitle</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
@ -50,6 +57,9 @@
<property name="text">
<string>Description</string>
</property>
<property name="buddy">
<cstring>m_txtDescription</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
@ -76,6 +86,9 @@
<height>40</height>
</size>
</property>
<property name="toolTip">
<string>Select icon for your category.</string>
</property>
<property name="text">
<string notr="true"/>
</property>
@ -124,6 +137,11 @@
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_buttonBox</tabstop>
<tabstop>m_cmbParentCategory</tabstop>
<tabstop>m_btnIcon</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
@ -133,8 +151,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
<x>325</x>
<y>170</y>
</hint>
<hint type="destinationlabel">
<x>286</x>

View File

@ -0,0 +1,13 @@
#include "gui/formstandardfeeddetails.h"
#include "core/feedsmodel.h"
FormStandardFeedDetails::FormStandardFeedDetails(FeedsModel *model, QWidget *parent)
: QDialog(parent), m_ui(new Ui::FormStandardFeedDetails) {
m_ui->setupUi(this);
}
FormStandardFeedDetails::~FormStandardFeedDetails() {
delete m_ui;
}

View File

@ -0,0 +1,26 @@
#ifndef FORMSTANDARDFEEDDETAILS_H
#define FORMSTANDARDFEEDDETAILS_H
#include <QDialog>
#include "ui_formstandardfeeddetails.h"
namespace Ui {
class FormStandardFeedDetails;
}
class FeedsModel;
class FormStandardFeedDetails : public QDialog {
Q_OBJECT
public:
explicit FormStandardFeedDetails(FeedsModel *model, QWidget *parent = 0);
virtual ~FormStandardFeedDetails();
private:
Ui::FormStandardFeedDetails *m_ui;
};
#endif // FORMSTANDARDFEEDDETAILS_H

View File

@ -0,0 +1,71 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>FormStandardFeedDetails</class>
<widget name="FormStandardFeedDetails" class="QDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget name="buttonBox" class="QDialogButtonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<pixmapfunction/>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>FormStandardFeedDetails</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>FormStandardFeedDetails</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -2,6 +2,10 @@
#include "core/defs.h"
#if !defined(Q_OS_WIN)
#include "gui/messagebox.h"
#endif
#include <QDesktopServices>
#include <QUrl>
#include <QLabel>
@ -14,6 +18,10 @@ FormWelcome::FormWelcome(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormWe
// Set flags.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
#if !defined(Q_OS_WIN)
MessageBox::iconify(m_ui->m_buttonBox);
#endif
// Set icon.
setWindowIcon(QIcon(APP_ICON_PATH));
m_ui->m_lblLogo->setPixmap(QPixmap(APP_ICON_PATH));

View File

@ -6,6 +6,7 @@
class IconFactory {
private:
// Constructors and destructors.
explicit IconFactory();
public:

View File

@ -240,6 +240,9 @@ void MessagesView::openSelectedSourceArticlesExternally() {
return;
}
}
// Finally, mark opened messages as read.
markSelectedMessagesRead();
}
void MessagesView::openSelectedSourceMessagesInternally() {
@ -256,6 +259,9 @@ void MessagesView::openSelectedSourceMessagesInternally() {
emit openLinkNewTab(message.m_url);
}
}
// Finally, mark opened messages as read.
markSelectedMessagesRead();
}
void MessagesView::openSelectedMessagesInternally() {
@ -266,6 +272,11 @@ void MessagesView::openSelectedMessagesInternally() {
}
emit openMessagesInNewspaperView(messages);
// Finally, mark opened messages as read.
// TODO: It is a question if to mark selected messages as read
// when they get opened externally/in new tab.
markSelectedMessagesRead();
}
void MessagesView::markSelectedMessagesRead() {