Some work on msg viewer and buttons.
This commit is contained in:
parent
b84fd00891
commit
c3ea32cf3d
src
@ -644,11 +644,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionServiceDelete">
|
<action name="m_actionServiceDelete">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Delete selected service account</string>
|
<string>&Delete selected service account</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionServiceEdit">
|
<action name="m_actionServiceEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Edit selected service account</string>
|
<string>&Edit selected service account</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -191,33 +191,12 @@ void FeedMessageViewer::quit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedMessageViewer::loadInitialFeeds() {
|
bool FeedMessageViewer::areToolBarsEnabled() const {
|
||||||
QString target_opml_file = APP_INITIAL_FEEDS_PATH + QDir::separator() + FEED_INITIAL_OPML_PATTERN;
|
return m_toolBarsEnabled;
|
||||||
QString current_locale = qApp->localization()->loadedLanguage();
|
}
|
||||||
QString file_to_load;
|
|
||||||
|
|
||||||
if (QFile::exists(target_opml_file.arg(current_locale))) {
|
bool FeedMessageViewer::areListHeadersEnabled() const {
|
||||||
file_to_load = target_opml_file.arg(current_locale);
|
return m_listHeadersEnabled;
|
||||||
}
|
|
||||||
else if (QFile::exists(target_opml_file.arg(DEFAULT_LOCALE))) {
|
|
||||||
file_to_load = target_opml_file.arg(DEFAULT_LOCALE);
|
|
||||||
}
|
|
||||||
|
|
||||||
FeedsImportExportModel model;
|
|
||||||
QString output_msg;
|
|
||||||
|
|
||||||
try {
|
|
||||||
model.importAsOPML20(IOFactory::readTextFile(file_to_load));
|
|
||||||
model.checkAllItems();
|
|
||||||
|
|
||||||
// TODO: double-check.
|
|
||||||
if (m_feedsView->sourceModel()->standardServiceRoot()->mergeImportExportModel(&model, output_msg)) {
|
|
||||||
m_feedsView->expandAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ApplicationException &ex) {
|
|
||||||
MessageBox::show(this, QMessageBox::Critical, tr("Error when loading initial feeds"), ex.message());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedMessageViewer::switchMessageSplitterOrientation() {
|
void FeedMessageViewer::switchMessageSplitterOrientation() {
|
||||||
@ -306,21 +285,25 @@ void FeedMessageViewer::updateMessageButtonsAvailability() {
|
|||||||
|
|
||||||
void FeedMessageViewer::updateFeedButtonsAvailability() {
|
void FeedMessageViewer::updateFeedButtonsAvailability() {
|
||||||
bool critical_action_running = qApp->feedUpdateLock()->isLocked();
|
bool critical_action_running = qApp->feedUpdateLock()->isLocked();
|
||||||
bool feed_selected = !m_feedsView->selectionModel()->selectedRows().isEmpty();
|
RootItem *selected_item = feedsView()->selectedItem();
|
||||||
|
bool anything_selected = selected_item != NULL;
|
||||||
|
bool feed_selected = anything_selected && selected_item->kind() == RootItemKind::Feed;
|
||||||
|
bool category_selected = anything_selected && selected_item->kind() == RootItemKind::Category;
|
||||||
|
bool service_selected = anything_selected && selected_item->kind() == RootItemKind::ServiceRoot;
|
||||||
FormMain *form_main = qApp->mainForm();
|
FormMain *form_main = qApp->mainForm();
|
||||||
|
|
||||||
form_main->m_ui->m_actionBackupDatabaseSettings->setEnabled(!critical_action_running);
|
form_main->m_ui->m_actionBackupDatabaseSettings->setEnabled(!critical_action_running);
|
||||||
form_main->m_ui->m_actionCleanupDatabase->setEnabled(!critical_action_running);
|
form_main->m_ui->m_actionCleanupDatabase->setEnabled(!critical_action_running);
|
||||||
form_main->m_ui->m_actionClearSelectedFeeds->setEnabled(feed_selected);
|
form_main->m_ui->m_actionClearSelectedFeeds->setEnabled(feed_selected || category_selected || service_selected);
|
||||||
form_main->m_ui->m_actionDeleteSelectedItem->setEnabled(!critical_action_running && feed_selected);
|
form_main->m_ui->m_actionDeleteSelectedItem->setEnabled(!critical_action_running && anything_selected);
|
||||||
form_main->m_ui->m_actionEditSelectedItem->setEnabled(!critical_action_running && feed_selected);
|
form_main->m_ui->m_actionEditSelectedItem->setEnabled(!critical_action_running && anything_selected);
|
||||||
form_main->m_ui->m_actionImportFeeds->setEnabled(!critical_action_running);
|
form_main->m_ui->m_actionImportFeeds->setEnabled(!critical_action_running);
|
||||||
form_main->m_ui->m_actionMarkSelectedFeedsAsRead->setEnabled(feed_selected);
|
form_main->m_ui->m_actionMarkSelectedFeedsAsRead->setEnabled(feed_selected || category_selected || service_selected);
|
||||||
form_main->m_ui->m_actionMarkSelectedFeedsAsUnread->setEnabled(feed_selected);
|
form_main->m_ui->m_actionMarkSelectedFeedsAsUnread->setEnabled(feed_selected || category_selected || service_selected);
|
||||||
form_main->m_ui->m_actionUpdateAllFeeds->setEnabled(!critical_action_running);
|
form_main->m_ui->m_actionUpdateAllFeeds->setEnabled(!critical_action_running);
|
||||||
form_main->m_ui->m_actionUpdateSelectedFeeds->setEnabled(!critical_action_running && feed_selected);
|
form_main->m_ui->m_actionUpdateSelectedFeeds->setEnabled(!critical_action_running && (feed_selected || category_selected || service_selected));
|
||||||
form_main->m_ui->m_actionViewSelectedItemsNewspaperMode->setEnabled(feed_selected);
|
form_main->m_ui->m_actionViewSelectedItemsNewspaperMode->setEnabled(feed_selected || category_selected || service_selected);
|
||||||
form_main->m_ui->m_actionExpandCollapseFeedCategory->setEnabled(feed_selected);
|
form_main->m_ui->m_actionExpandCollapseFeedCategory->setEnabled(feed_selected || category_selected || service_selected);
|
||||||
form_main->m_ui->m_menuAddItem->setEnabled(!critical_action_running);
|
form_main->m_ui->m_menuAddItem->setEnabled(!critical_action_running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,17 +79,10 @@ class FeedMessageViewer : public TabContent {
|
|||||||
// stops any child widgets/workers.
|
// stops any child widgets/workers.
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
inline bool areToolBarsEnabled() const {
|
bool areToolBarsEnabled() const;
|
||||||
return m_toolBarsEnabled;
|
bool areListHeadersEnabled() const;
|
||||||
}
|
|
||||||
|
|
||||||
inline bool areListHeadersEnabled() const {
|
|
||||||
return m_listHeadersEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadInitialFeeds();
|
|
||||||
|
|
||||||
// Switches orientation horizontal/vertical.
|
// Switches orientation horizontal/vertical.
|
||||||
void switchMessageSplitterOrientation();
|
void switchMessageSplitterOrientation();
|
||||||
|
|
||||||
|
@ -46,11 +46,6 @@ class Feed : public RootItem {
|
|||||||
OtherError = 4
|
OtherError = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ReadStatus {
|
|
||||||
Unread = 0,
|
|
||||||
Read = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
// Constructors.
|
// Constructors.
|
||||||
explicit Feed(RootItem *parent = NULL);
|
explicit Feed(RootItem *parent = NULL);
|
||||||
virtual ~Feed();
|
virtual ~Feed();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user