Many things changed and tweaked: added one button to tray icon menu.
This commit is contained in:
parent
5338d2d212
commit
16a98a57ba
@ -219,6 +219,8 @@ void FeedMessageViewer::createConnections() {
|
||||
SIGNAL(triggered()), this, SLOT(updateAllFeeds()));
|
||||
connect(FormMain::instance()->m_ui->m_actionAddStandardCategory,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(addNewStandardCategory()));
|
||||
connect(FormMain::instance()->m_ui->m_actionAddStandardFeed,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(addNewStandardFeed()));
|
||||
connect(FormMain::instance()->m_ui->m_actionEditSelectedFeedCategory,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(editSelectedItem()));
|
||||
connect(FormMain::instance()->m_ui->m_actionViewSelectedItemsNewspaperMode,
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "core/feedsmodelstandardcategory.h"
|
||||
#include "gui/formmain.h"
|
||||
#include "gui/formstandardcategorydetails.h"
|
||||
#include "gui/formstandardfeeddetails.h"
|
||||
#include "gui/systemtrayicon.h"
|
||||
#include "gui/messagebox.h"
|
||||
|
||||
@ -79,15 +80,15 @@ void FeedsView::addNewStandardCategory() {
|
||||
// it is used probably by feed updater or application
|
||||
// is quitting.
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
SystemTrayIcon::instance()->showMessage(tr("Cannot add category"),
|
||||
tr("You cannot add new category now because feed update is ongoing."),
|
||||
SystemTrayIcon::instance()->showMessage(tr("Cannot add standard category"),
|
||||
tr("You cannot add new standard category now because feed update is ongoing."),
|
||||
QSystemTrayIcon::Warning);
|
||||
}
|
||||
else {
|
||||
MessageBox::show(this,
|
||||
QMessageBox::Warning,
|
||||
tr("Cannot add category"),
|
||||
tr("You cannot add new category now because feed update is ongoing."));
|
||||
tr("Cannot add standard category"),
|
||||
tr("You cannot add new standard category now because feed update is ongoing."));
|
||||
}
|
||||
|
||||
// Thus, cannot delete and quit the method.
|
||||
@ -123,6 +124,42 @@ void FeedsView::editStandardCategory(FeedsModelStandardCategory *category) {
|
||||
delete form_pointer.data();
|
||||
}
|
||||
|
||||
void FeedsView::addNewStandardFeed() {
|
||||
if (!SystemFactory::instance()->applicationCloseLock()->tryLockForWrite()) {
|
||||
// Lock was not obtained because
|
||||
// it is used probably by feed updater or application
|
||||
// is quitting.
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
SystemTrayIcon::instance()->showMessage(tr("Cannot add standard feed"),
|
||||
tr("You cannot add new standard feed now because feed update is ongoing."),
|
||||
QSystemTrayIcon::Warning);
|
||||
}
|
||||
else {
|
||||
MessageBox::show(this,
|
||||
QMessageBox::Warning,
|
||||
tr("Cannot add standard feed"),
|
||||
tr("You cannot add new standard feed now because feed update is ongoing."));
|
||||
}
|
||||
|
||||
// Thus, cannot delete and quit the method.
|
||||
return;
|
||||
}
|
||||
|
||||
QPointer<FormStandardFeedDetails> form_pointer = new FormStandardFeedDetails(m_sourceModel, this);
|
||||
|
||||
if (form_pointer.data()->exec(NULL) == QDialog::Accepted) {
|
||||
// TODO: nova kategorie pridana
|
||||
}
|
||||
else {
|
||||
// TODO: nova kategorie nepridana
|
||||
}
|
||||
|
||||
delete form_pointer.data();
|
||||
|
||||
// Changes are done, unlock the update master lock.
|
||||
SystemFactory::instance()->applicationCloseLock()->unlock();
|
||||
}
|
||||
|
||||
void FeedsView::editSelectedItem() {
|
||||
if (!SystemFactory::instance()->applicationCloseLock()->tryLockForWrite()) {
|
||||
// Lock was not obtained because
|
||||
|
@ -76,6 +76,9 @@ class FeedsView : public QTreeView {
|
||||
void addNewStandardCategory();
|
||||
void editStandardCategory(FeedsModelStandardCategory *category);
|
||||
|
||||
// Standard feed manipulators.
|
||||
void addNewStandardFeed();
|
||||
|
||||
// Reloads counts for selected feeds.
|
||||
void updateCountsOfSelectedFeeds(bool update_total_too = true);
|
||||
|
||||
|
@ -86,8 +86,6 @@ QList<QAction*> FormMain::allActions() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FormMain::prepareMenus() {
|
||||
// Setup menu for tray icon.
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
@ -98,6 +96,8 @@ void FormMain::prepareMenus() {
|
||||
#endif
|
||||
|
||||
// Add needed items to the menu.
|
||||
m_trayMenu->addAction(m_ui->m_actionUpdateAllFeeds);
|
||||
m_trayMenu->addSeparator();
|
||||
m_trayMenu->addAction(m_ui->m_actionSettings);
|
||||
m_trayMenu->addAction(m_ui->m_actionQuit);
|
||||
|
||||
|
@ -67,7 +67,7 @@ void FormStandardCategoryDetails::setEditableCategory(FeedsModelStandardCategory
|
||||
int FormStandardCategoryDetails::exec(FeedsModelStandardCategory *input_category) {
|
||||
if (input_category == NULL) {
|
||||
// User is adding new category.
|
||||
setWindowTitle(tr("Add new category"));
|
||||
setWindowTitle(tr("Add new standard category"));
|
||||
|
||||
// Make sure that "default" icon is used as the default option for new
|
||||
// categories.
|
||||
@ -75,7 +75,7 @@ int FormStandardCategoryDetails::exec(FeedsModelStandardCategory *input_category
|
||||
}
|
||||
else {
|
||||
// User is editing existing category.
|
||||
setWindowTitle(tr("Edit existing category"));
|
||||
setWindowTitle(tr("Edit existing standard category"));
|
||||
setEditableCategory(input_category);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
|
@ -1,13 +1,48 @@
|
||||
#include "gui/formstandardfeeddetails.h"
|
||||
|
||||
#include "core/feedsmodel.h"
|
||||
#include "gui/iconthemefactory.h"
|
||||
|
||||
#if !defined(Q_OS_WIN)
|
||||
#include "gui/messagebox.h"
|
||||
#endif
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
FormStandardFeedDetails::FormStandardFeedDetails(FeedsModel *model, QWidget *parent)
|
||||
: QDialog(parent), m_ui(new Ui::FormStandardFeedDetails) {
|
||||
m_ui->setupUi(this);
|
||||
: QDialog(parent) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
FormStandardFeedDetails::~FormStandardFeedDetails() {
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
int FormStandardFeedDetails::exec(FeedsModelStandardFeed *input_feed) {
|
||||
if (input_feed == NULL) {
|
||||
// User is adding new category.
|
||||
setWindowTitle(tr("Add new standard feed"));
|
||||
}
|
||||
else {
|
||||
// User is editing existing category.
|
||||
setWindowTitle(tr("Edit existing standard feed"));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FormStandardFeedDetails::initialize() {
|
||||
m_ui = new Ui::FormStandardFeedDetails();
|
||||
m_ui->setupUi(this);
|
||||
|
||||
// Set flags and attributes.
|
||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
|
||||
setWindowIcon(IconThemeFactory::instance()->fromTheme("document-new"));
|
||||
|
||||
// Setup button box.
|
||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
|
||||
#if !defined(Q_OS_WIN)
|
||||
MessageBox::iconify(m_ui->m_buttonBox);
|
||||
#endif
|
||||
}
|
||||
|
@ -11,14 +11,22 @@ namespace Ui {
|
||||
}
|
||||
|
||||
class FeedsModel;
|
||||
class FeedsModelStandardFeed;
|
||||
|
||||
class FormStandardFeedDetails : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Constructors and destructors.
|
||||
explicit FormStandardFeedDetails(FeedsModel *model, QWidget *parent = 0);
|
||||
virtual ~FormStandardFeedDetails();
|
||||
|
||||
public slots:
|
||||
int exec(FeedsModelStandardFeed *input_feed);
|
||||
|
||||
protected:
|
||||
void initialize();
|
||||
|
||||
private:
|
||||
Ui::FormStandardFeedDetails *m_ui;
|
||||
};
|
||||
|
@ -1,9 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>FormStandardFeedDetails</class>
|
||||
<widget name="FormStandardFeedDetails" class="QDialog">
|
||||
<widget class="QDialog" name="FormStandardFeedDetails">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -15,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget name="buttonBox" class="QDialogButtonBox">
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
@ -32,11 +30,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FormStandardFeedDetails</receiver>
|
||||
<slot>accept()</slot>
|
||||
@ -52,7 +49,7 @@
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FormStandardFeedDetails</receiver>
|
||||
<slot>reject()</slot>
|
||||
|
Loading…
x
Reference in New Issue
Block a user