Some extra stuff for recycle bin, general usability enhancements.
This commit is contained in:
parent
0e6f807d85
commit
63abccc7a5
@ -477,6 +477,17 @@ FeedsModelCategory *FeedsModel::categoryForIndex(const QModelIndex &index) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FeedsModelRecycleBin *FeedsModel::recycleBinForIndex(const QModelIndex &index) const {
|
||||||
|
FeedsModelRootItem *item = itemForIndex(index);
|
||||||
|
|
||||||
|
if (item->kind() == FeedsModelRootItem::RecycleBin) {
|
||||||
|
return static_cast<FeedsModelRecycleBin*>(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex FeedsModel::indexForItem(FeedsModelRootItem *item) const {
|
QModelIndex FeedsModel::indexForItem(FeedsModelRootItem *item) const {
|
||||||
if (item == NULL || item->kind() == FeedsModelRootItem::RootItem) {
|
if (item == NULL || item->kind() == FeedsModelRootItem::RootItem) {
|
||||||
// Root item lies on invalid index.
|
// Root item lies on invalid index.
|
||||||
|
@ -122,6 +122,8 @@ class FeedsModel : public QAbstractItemModel {
|
|||||||
// or NULL if no category lies in given index.
|
// or NULL if no category lies in given index.
|
||||||
FeedsModelCategory *categoryForIndex(const QModelIndex &index) const;
|
FeedsModelCategory *categoryForIndex(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
FeedsModelRecycleBin *recycleBinForIndex(const QModelIndex &index) const;
|
||||||
|
|
||||||
// Returns feed/category which lies at the specified index or
|
// Returns feed/category which lies at the specified index or
|
||||||
// root item if index is invalid.
|
// root item if index is invalid.
|
||||||
FeedsModelRootItem *itemForIndex(const QModelIndex &index) const;
|
FeedsModelRootItem *itemForIndex(const QModelIndex &index) const;
|
||||||
|
@ -119,6 +119,11 @@ FeedsModelFeed *FeedsView::selectedFeed() const {
|
|||||||
return m_sourceModel->feedForIndex(current_mapped);
|
return m_sourceModel->feedForIndex(current_mapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FeedsModelRecycleBin *FeedsView::selectedRecycleBin() const{
|
||||||
|
QModelIndex current_mapped = m_proxyModel->mapToSource(currentIndex());
|
||||||
|
return m_sourceModel->recycleBinForIndex(current_mapped);
|
||||||
|
}
|
||||||
|
|
||||||
void FeedsView::saveExpandedStates() {
|
void FeedsView::saveExpandedStates() {
|
||||||
Settings *settings = qApp->settings();
|
Settings *settings = qApp->settings();
|
||||||
|
|
||||||
@ -305,20 +310,7 @@ void FeedsView::editSelectedItem() {
|
|||||||
editCategory(static_cast<FeedsModelCategory*>(category));
|
editCategory(static_cast<FeedsModelCategory*>(category));
|
||||||
}
|
}
|
||||||
else if ((feed = selectedFeed()) != NULL) {
|
else if ((feed = selectedFeed()) != NULL) {
|
||||||
// Feed is selected.
|
editFeed(static_cast<FeedsModelFeed*>(feed));
|
||||||
switch (feed->type()) {
|
|
||||||
case FeedsModelFeed::Atom10:
|
|
||||||
case FeedsModelFeed::Rdf:
|
|
||||||
case FeedsModelFeed::Rss0X:
|
|
||||||
case FeedsModelFeed::Rss2X: {
|
|
||||||
// User wants to edit standard feed.
|
|
||||||
editFeed(static_cast<FeedsModelFeed*>(feed));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changes are done, unlock the update master lock.
|
// Changes are done, unlock the update master lock.
|
||||||
@ -412,6 +404,13 @@ void FeedsView::openSelectedFeedsInNewspaperMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::emptyRecycleBin() {
|
void FeedsView::emptyRecycleBin() {
|
||||||
|
if (MessageBox::show(qApp->mainForm(), QMessageBox::Question, tr("Permanently delete messages"),
|
||||||
|
tr("You are about to permanenty delete all messages from your recycle bin."), tr("Do you really want to empty your recycle bin?"),
|
||||||
|
QString(), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::No) {
|
||||||
|
// User changed his mind.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_sourceModel->recycleBin()->empty();
|
m_sourceModel->recycleBin()->empty();
|
||||||
updateCountsOfSelectedFeeds();
|
updateCountsOfSelectedFeeds();
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ class FeedsView : public QTreeView {
|
|||||||
// selected.
|
// selected.
|
||||||
FeedsModelCategory *selectedCategory() const;
|
FeedsModelCategory *selectedCategory() const;
|
||||||
FeedsModelFeed *selectedFeed() const;
|
FeedsModelFeed *selectedFeed() const;
|
||||||
|
FeedsModelRecycleBin *selectedRecycleBin() const;
|
||||||
|
|
||||||
// Saves/loads expand states of all nodes (feeds/categories) of the list to/from settings.
|
// Saves/loads expand states of all nodes (feeds/categories) of the list to/from settings.
|
||||||
void saveExpandedStates();
|
void saveExpandedStates();
|
||||||
|
@ -126,6 +126,10 @@ QList<QAction*> FormMain::allActions() {
|
|||||||
actions << m_ui->m_actionSelectPreviousMessage;
|
actions << m_ui->m_actionSelectPreviousMessage;
|
||||||
actions << m_ui->m_actionDefragmentDatabase;
|
actions << m_ui->m_actionDefragmentDatabase;
|
||||||
|
|
||||||
|
// Add recycle bin actions.
|
||||||
|
actions << m_ui->m_actionRestoreAllMessages;
|
||||||
|
actions << m_ui->m_actionEmptyRecycleBin;
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,10 +278,12 @@ void MessagesView::openSelectedMessagesInternally() {
|
|||||||
messages << m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row());
|
messages << m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row());
|
||||||
}
|
}
|
||||||
|
|
||||||
emit openMessagesInNewspaperView(messages);
|
if (!messages.isEmpty()) {
|
||||||
|
emit openMessagesInNewspaperView(messages);
|
||||||
|
|
||||||
// Finally, mark opened messages as read.
|
// Finally, mark opened messages as read.
|
||||||
markSelectedMessagesRead();
|
markSelectedMessagesRead();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesView::markSelectedMessagesRead() {
|
void MessagesView::markSelectedMessagesRead() {
|
||||||
|
@ -96,7 +96,7 @@ int main(int argc, char *argv[]) {
|
|||||||
main_window.setWindowTitle(APP_LONG_NAME);
|
main_window.setWindowTitle(APP_LONG_NAME);
|
||||||
|
|
||||||
// Now is a good time to initialize dynamic keyboard shortcuts.
|
// Now is a good time to initialize dynamic keyboard shortcuts.
|
||||||
DynamicShortcuts::load(main_window.allActions());
|
DynamicShortcuts::load(qApp->userActions());
|
||||||
|
|
||||||
// Display main window.
|
// Display main window.
|
||||||
if (qApp->settings()->value(APP_CFG_GUI, "start_hidden", false).toBool() && SystemTrayIcon::isSystemTrayActivated()) {
|
if (qApp->settings()->value(APP_CFG_GUI, "start_hidden", false).toBool() && SystemTrayIcon::isSystemTrayActivated()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user