diff --git a/CMakeLists.txt b/CMakeLists.txt index 0831dc665..10319b35e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/src/core/feedsmodel.cpp b/src/core/feedsmodel.cpp index dd9af3784..9e771062e 100644 --- a/src/core/feedsmodel.cpp +++ b/src/core/feedsmodel.cpp @@ -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 FeedsModel::messagesForFeeds(const QList &feeds) { QList messages; diff --git a/src/core/feedsmodel.h b/src/core/feedsmodel.h index d1bb7e416..dfd6b3fc9 100644 --- a/src/core/feedsmodel.h +++ b/src/core/feedsmodel.h @@ -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 messagesForFeeds(const QList &feeds); diff --git a/src/core/feedsmodelrootitem.cpp b/src/core/feedsmodelrootitem.cpp index 923b93ad6..3b5dab491 100755 --- a/src/core/feedsmodelrootitem.cpp +++ b/src/core/feedsmodelrootitem.cpp @@ -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 { diff --git a/src/core/feedsmodelrootitem.h b/src/core/feedsmodelrootitem.h index a71b68b72..6b6030c30 100755 --- a/src/core/feedsmodelrootitem.h +++ b/src/core/feedsmodelrootitem.h @@ -60,9 +60,14 @@ class FeedsModelRootItem { // Access to children. QList 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); diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index e296b6389..3558abd76 100644 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -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() { diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index 93554fa07..6aeb92592 100644 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -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); diff --git a/src/gui/feedsview.h b/src/gui/feedsview.h index 68f9e661b..78bfbec52 100644 --- a/src/gui/feedsview.h +++ b/src/gui/feedsview.h @@ -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); diff --git a/src/gui/statusbar.cpp b/src/gui/statusbar.cpp index add12361c..cbc368112 100644 --- a/src/gui/statusbar.cpp +++ b/src/gui/statusbar.cpp @@ -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);