Some status bar things and feedsmodel updates.
This commit is contained in:
parent
e59f020a64
commit
8b243d57c7
@ -48,7 +48,6 @@ set(APP_URL "http://martinrotter.github.io/rssguard")
|
||||
set(APP_URL_ISSUES "http://github.com/martinrotter/rssguard/issues")
|
||||
set(APP_EMAIL "rotter.martinos@gmail.com")
|
||||
set(MINIMUM_QT_VERSION 4.7.3)
|
||||
set(SOURCE_PACKAGE_SUFFIX "Source")
|
||||
set(EXE_NAME ${APP_LOW_NAME})
|
||||
|
||||
# Options declaration.
|
||||
@ -538,7 +537,7 @@ set(CPACK_PACKAGE_NAME ${APP_LOW_NAME})
|
||||
set(CPACK_PACKAGE_VERSION ${APP_VERSION})
|
||||
set(CPACK_IGNORE_FILES "/resources/aur/;\\\\.psd$;/resources/deployment;/CVS/;/\\\\.svn/;/\\\\.git/;\\\\.swp$;/CMakeLists.txt.user;\\\\.#;/#;\\\\.tar.gz$;/CMakeFiles/;CMakeCache.txt;\\\\.qm$;/build/;\\\\.diff$;.DS_Store'")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${SOURCE_PACKAGE_SUFFIX}")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
set(CPACK_SOURCE_IGNORE_FILES ${CPACK_IGNORE_FILES})
|
||||
|
||||
# Load packaging facilities.
|
||||
|
@ -131,6 +131,29 @@ int FeedsModel::rowCount(const QModelIndex &parent) const {
|
||||
return parent_item->childCount();
|
||||
}
|
||||
|
||||
bool FeedsModel::removeItems(const QModelIndexList &indexes) {
|
||||
foreach (const QModelIndex &index, indexes) {
|
||||
QModelIndex parent = index.parent();
|
||||
|
||||
FeedsModelRootItem *item = itemForIndex(index);
|
||||
|
||||
if (item->kind() != FeedsModelRootItem::RootItem) {
|
||||
// TODO: Selected item is category or feed, delete it.
|
||||
|
||||
FeedsModelRootItem *parent_item = itemForIndex(parent);
|
||||
|
||||
beginRemoveRows(parent, index.row(), index.row());
|
||||
FeedsModelRootItem *deleted_item = parent_item->removeChild(index.row());
|
||||
delete deleted_item;
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed *> &feeds) {
|
||||
QList<Message> messages;
|
||||
|
||||
|
@ -33,6 +33,9 @@ class FeedsModel : public QAbstractItemModel {
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
|
||||
// Feed/category manipulators.
|
||||
bool removeItems(const QModelIndexList &indexes);
|
||||
|
||||
// Returns all (undeleted) messages for given feeds.
|
||||
QList<Message> messagesForFeeds(const QList<FeedsModelFeed*> &feeds);
|
||||
|
||||
|
@ -103,6 +103,14 @@ void FeedsModelRootItem::clearChilds() {
|
||||
m_childItems.clear();
|
||||
}
|
||||
|
||||
FeedsModelRootItem *FeedsModelRootItem::removeChild(int index) {
|
||||
FeedsModelRootItem *item_to_delete = m_childItems.at(index);
|
||||
|
||||
m_childItems.removeAt(index);
|
||||
|
||||
return item_to_delete;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QDateTime FeedsModelRootItem::creationDate() const {
|
||||
|
@ -60,9 +60,14 @@ class FeedsModelRootItem {
|
||||
// Access to children.
|
||||
QList<FeedsModelRootItem *> childItems() const;
|
||||
|
||||
// Removes all childs from this item.
|
||||
// Removes all children from this item.
|
||||
// NOTE: Children are NOT freed from the memory.
|
||||
void clearChilds();
|
||||
|
||||
// Removes particular child at given index.
|
||||
// NOTE: Child is NOT freed from the memory.
|
||||
FeedsModelRootItem *removeChild(int index);
|
||||
|
||||
// Compares two model items.
|
||||
static bool isEqual(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs);
|
||||
static bool lessThan(FeedsModelRootItem *lhs, FeedsModelRootItem *rhs);
|
||||
|
@ -206,6 +206,8 @@ void FeedMessageViewer::createConnections() {
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(editSelectedItem()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionViewSelectedItemsNewspaperMode,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(openSelectedFeedsInNewspaperMode()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionDeleteSelectedFeedsCategories,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(deleteSelectedItems()));
|
||||
}
|
||||
|
||||
void FeedMessageViewer::initialize() {
|
||||
|
@ -107,6 +107,13 @@ void FeedsView::editSelectedItem() {
|
||||
|
||||
}
|
||||
|
||||
void FeedsView::deleteSelectedItems() {
|
||||
QModelIndexList selection = selectionModel()->selectedRows();
|
||||
QModelIndexList mapped_selection = m_proxyModel->mapListToSource(selection);
|
||||
|
||||
m_sourceModel->removeItems(mapped_selection);
|
||||
}
|
||||
|
||||
void FeedsView::markSelectedFeedsReadStatus(int read) {
|
||||
m_sourceModel->markFeedsRead(selectedFeeds(), read);
|
||||
updateCountsOfSelectedFeeds(false);
|
||||
|
@ -66,6 +66,7 @@ class FeedsView : public QTreeView {
|
||||
// Category operators.
|
||||
void addNewCategory();
|
||||
void editSelectedItem();
|
||||
void deleteSelectedItems();
|
||||
|
||||
// Reloads counts for selected feeds.
|
||||
void updateCountsOfSelectedFeeds(bool update_total_too = true);
|
||||
|
@ -8,7 +8,8 @@
|
||||
|
||||
|
||||
StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
||||
setContentsMargins(3, 1, 3, 1);
|
||||
setSizeGripEnabled(false);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
// Initializations of widgets for status bar.
|
||||
m_fullscreenSwitcher = new QToolButton(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user