From 5338d2d212577e7b7d10d629e0ae55c11479081c Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 29 Jan 2014 12:26:50 +0100 Subject: [PATCH] All messages marked read when opened externally/newspaper + added initial dialog for adding/editing standard feeds. --- CMakeLists.txt | 3 ++ src/gui/feedmessageviewer.cpp | 6 +-- src/gui/feedsview.cpp | 1 + src/gui/formabout.cpp | 8 +++ src/gui/formmain.cpp | 6 +-- src/gui/formmain.ui | 9 ++-- src/gui/formsettings.cpp | 4 ++ src/gui/formstandardcategorydetails.cpp | 20 +++++-- src/gui/formstandardcategorydetails.ui | 24 +++++++-- src/gui/formstandardfeeddetails.cpp | 13 +++++ src/gui/formstandardfeeddetails.h | 26 +++++++++ src/gui/formstandardfeeddetails.ui | 71 +++++++++++++++++++++++++ src/gui/formwelcome.cpp | 8 +++ src/gui/iconfactory.h | 1 + src/gui/messagesview.cpp | 11 ++++ 15 files changed, 189 insertions(+), 22 deletions(-) create mode 100644 src/gui/formstandardfeeddetails.cpp create mode 100644 src/gui/formstandardfeeddetails.h create mode 100644 src/gui/formstandardfeeddetails.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index cacb75e4e..6456469e7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index bb87cd1f6..f920dff19 100644 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -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); diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index e9f70df63..0462ab5d9 100644 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -250,6 +250,7 @@ void FeedsView::openSelectedFeedsInNewspaperMode() { if (!messages.isEmpty()) { emit openMessagesInNewspaperView(messages); + markSelectedFeedsRead(); } } diff --git a/src/gui/formabout.cpp b/src/gui/formabout.cpp index cb7ca0905..5f904f672 100644 --- a/src/gui/formabout.cpp +++ b/src/gui/formabout.cpp @@ -2,6 +2,9 @@ #include "core/textfactory.h" #include "gui/iconthemefactory.h" +#if !defined(Q_OS_WIN) +#include "gui/messagebox.h" +#endif #include #include @@ -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. diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index 26b0d7f63..d7fc6d050 100755 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -55,10 +55,6 @@ FormMain *FormMain::instance() { return s_instance; } - - - - QList FormMain::allActions() { QList 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")); diff --git a/src/gui/formmain.ui b/src/gui/formmain.ui index 0d4ab8c9e..0cad1df80 100644 --- a/src/gui/formmain.ui +++ b/src/gui/formmain.ui @@ -97,7 +97,7 @@ - + @@ -324,16 +324,13 @@ Remove all messages from selected feeds. - + - Add new &feed + Add new standard &feed Add new feed. - - - diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp index ebe275f17..5326c64cd 100755 --- a/src/gui/formsettings.cpp +++ b/src/gui/formsettings.cpp @@ -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); diff --git a/src/gui/formstandardcategorydetails.cpp b/src/gui/formstandardcategorydetails.cpp index 931779cdb..92a7295ff 100644 --- a/src/gui/formstandardcategorydetails.cpp +++ b/src/gui/formstandardcategorydetails.cpp @@ -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 #include @@ -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"), diff --git a/src/gui/formstandardcategorydetails.ui b/src/gui/formstandardcategorydetails.ui index c75107815..97205c707 100644 --- a/src/gui/formstandardcategorydetails.ui +++ b/src/gui/formstandardcategorydetails.ui @@ -36,13 +36,20 @@ - + + + Select parent item for your category. + + Title + + m_txtTitle + @@ -50,6 +57,9 @@ Description + + m_txtDescription + @@ -76,6 +86,9 @@ 40 + + Select icon for your category. + @@ -124,6 +137,11 @@ 1 + + m_buttonBox + m_cmbParentCategory + m_btnIcon + @@ -133,8 +151,8 @@ reject() - 316 - 260 + 325 + 170 286 diff --git a/src/gui/formstandardfeeddetails.cpp b/src/gui/formstandardfeeddetails.cpp new file mode 100644 index 000000000..3be052508 --- /dev/null +++ b/src/gui/formstandardfeeddetails.cpp @@ -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; +} diff --git a/src/gui/formstandardfeeddetails.h b/src/gui/formstandardfeeddetails.h new file mode 100644 index 000000000..d591c906f --- /dev/null +++ b/src/gui/formstandardfeeddetails.h @@ -0,0 +1,26 @@ +#ifndef FORMSTANDARDFEEDDETAILS_H +#define FORMSTANDARDFEEDDETAILS_H + +#include + +#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 diff --git a/src/gui/formstandardfeeddetails.ui b/src/gui/formstandardfeeddetails.ui new file mode 100644 index 000000000..e6a01ff9b --- /dev/null +++ b/src/gui/formstandardfeeddetails.ui @@ -0,0 +1,71 @@ + + + + + FormStandardFeedDetails + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + buttonBox + accepted() + FormStandardFeedDetails + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + FormStandardFeedDetails + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/gui/formwelcome.cpp b/src/gui/formwelcome.cpp index 79e94dbe1..a94347ac0 100644 --- a/src/gui/formwelcome.cpp +++ b/src/gui/formwelcome.cpp @@ -2,6 +2,10 @@ #include "core/defs.h" +#if !defined(Q_OS_WIN) +#include "gui/messagebox.h" +#endif + #include #include #include @@ -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)); diff --git a/src/gui/iconfactory.h b/src/gui/iconfactory.h index 70ca26477..993e2b399 100644 --- a/src/gui/iconfactory.h +++ b/src/gui/iconfactory.h @@ -6,6 +6,7 @@ class IconFactory { private: + // Constructors and destructors. explicit IconFactory(); public: diff --git a/src/gui/messagesview.cpp b/src/gui/messagesview.cpp index 3b2f66073..12ee46981 100644 --- a/src/gui/messagesview.cpp +++ b/src/gui/messagesview.cpp @@ -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() {