diff --git a/rssguard.pro b/rssguard.pro index a1eba76e2..5434c1d30 100755 --- a/rssguard.pro +++ b/rssguard.pro @@ -332,7 +332,9 @@ HEADERS += src/core/feeddownloader.h \ src/gui/guiutilities.h \ src/core/messagesmodelcache.h \ src/core/messagesmodelsqllayer.h \ - src/gui/treeviewcolumnsmenu.h + src/gui/treeviewcolumnsmenu.h \ + src/services/abstract/labelsrootitem.h \ + src/services/abstract/label.h SOURCES += src/core/feeddownloader.cpp \ src/core/feedsmodel.cpp \ @@ -456,7 +458,9 @@ SOURCES += src/core/feeddownloader.cpp \ src/gui/guiutilities.cpp \ src/core/messagesmodelcache.cpp \ src/core/messagesmodelsqllayer.cpp \ - src/gui/treeviewcolumnsmenu.cpp + src/gui/treeviewcolumnsmenu.cpp \ + src/services/abstract/labelsrootitem.cpp \ + src/services/abstract/label.cpp FORMS += src/gui/toolbareditor.ui \ src/network-web/downloaditem.ui \ diff --git a/src/definitions/definitions.h b/src/definitions/definitions.h index 76403d7b6..01b1dee21 100755 --- a/src/definitions/definitions.h +++ b/src/definitions/definitions.h @@ -48,6 +48,7 @@ #define CLOSE_LOCK_TIMEOUT 500 #define DOWNLOAD_TIMEOUT 5000 #define MESSAGES_VIEW_DEFAULT_COL 170 +#define MESSAGES_VIEW_MINIMUM_COL 36 #define FEEDS_VIEW_COLUMN_COUNT 2 #define FEED_DOWNLOADER_MAX_THREADS 6 #define DEFAULT_DAYS_TO_DELETE_MSG 14 diff --git a/src/gui/messagesview.cpp b/src/gui/messagesview.cpp index 99c11b51a..7174dc558 100755 --- a/src/gui/messagesview.cpp +++ b/src/gui/messagesview.cpp @@ -151,8 +151,11 @@ void MessagesView::setupAppearance() { setAllColumnsShowFocus(false); setSelectionMode(QAbstractItemView::ExtendedSelection); setItemDelegate(new StyledItemDelegateWithoutFocus(this)); + header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL); - header()->setStretchLastSection(false); + header()->setMinimumSectionSize(MESSAGES_VIEW_MINIMUM_COL); + header()->setCascadingSectionResizes(false); + header()->setStretchLastSection(true); header()->setSortIndicatorShown(true); } @@ -510,13 +513,16 @@ void MessagesView::adjustColumns() { header()->setSectionResizeMode(MSG_DB_DELETED_INDEX, QHeaderView::Interactive); header()->setSectionResizeMode(MSG_DB_IMPORTANT_INDEX, QHeaderView::ResizeToContents); header()->setSectionResizeMode(MSG_DB_FEED_TITLE_INDEX, QHeaderView::Interactive); - header()->setSectionResizeMode(MSG_DB_TITLE_INDEX, QHeaderView::Stretch); + header()->setSectionResizeMode(MSG_DB_TITLE_INDEX, QHeaderView::Interactive); header()->setSectionResizeMode(MSG_DB_URL_INDEX, QHeaderView::Interactive); header()->setSectionResizeMode(MSG_DB_AUTHOR_INDEX, QHeaderView::Interactive); header()->setSectionResizeMode(MSG_DB_DCREATED_INDEX, QHeaderView::Interactive); header()->setSectionResizeMode(MSG_DB_CONTENTS_INDEX, QHeaderView::Interactive); header()->setSectionResizeMode(MSG_DB_PDELETED_INDEX, QHeaderView::Interactive); + //header()->resizeSection(MSG_DB_READ_INDEX, MESSAGES_VIEW_MINIMUM_COL); + //header()->resizeSection(MSG_DB_IMPORTANT_INDEX, MESSAGES_VIEW_MINIMUM_COL); + // Hide columns. hideColumn(MSG_DB_ID_INDEX); hideColumn(MSG_DB_DELETED_INDEX); diff --git a/src/services/abstract/label.cpp b/src/services/abstract/label.cpp new file mode 100755 index 000000000..a831d3bd9 --- /dev/null +++ b/src/services/abstract/label.cpp @@ -0,0 +1,22 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2017 by Martin Rotter +// +// RSS Guard is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// RSS Guard is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with RSS Guard. If not, see . + +#include "services/abstract/label.h" + + +Label::Label(RootItem *parent_item) : RootItem(parent_item) { +} diff --git a/src/services/abstract/label.h b/src/services/abstract/label.h new file mode 100755 index 000000000..853f4888a --- /dev/null +++ b/src/services/abstract/label.h @@ -0,0 +1,29 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2017 by Martin Rotter +// +// RSS Guard is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// RSS Guard is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with RSS Guard. If not, see . + +#ifndef LABEL_H +#define LABEL_H + +#include "services/abstract/rootitem.h" + + +class Label : public RootItem { + public: + explicit Label(RootItem *parent_item = nullptr); +}; + +#endif // LABEL_H diff --git a/src/services/abstract/labelsrootitem.cpp b/src/services/abstract/labelsrootitem.cpp new file mode 100755 index 000000000..471d9133e --- /dev/null +++ b/src/services/abstract/labelsrootitem.cpp @@ -0,0 +1,28 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2017 by Martin Rotter +// +// RSS Guard is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// RSS Guard is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with RSS Guard. If not, see . + +#include "services/abstract/labelsrootitem.h" + +#include "miscellaneous/iconfactory.h" + + +LabelsRootItem::LabelsRootItem(RootItem *parent_item) : RootItem(parent_item) { + setTitle(tr("Labels")); + setIcon(qApp->icons()->fromTheme(QSL("stock_bookmark"))); + + setKind(RootItemKind::LabelsRoot); +} diff --git a/src/services/abstract/labelsrootitem.h b/src/services/abstract/labelsrootitem.h new file mode 100755 index 000000000..1031864b3 --- /dev/null +++ b/src/services/abstract/labelsrootitem.h @@ -0,0 +1,29 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2017 by Martin Rotter +// +// RSS Guard is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// RSS Guard is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with RSS Guard. If not, see . + +#ifndef LABELSROOTITEM_H +#define LABELSROOTITEM_H + +#include "services/abstract/rootitem.h" + + +class LabelsRootItem : public RootItem { + public: + explicit LabelsRootItem(RootItem *parent_item = nullptr); +}; + +#endif // LABELSROOTITEM_H diff --git a/src/services/abstract/rootitem.h b/src/services/abstract/rootitem.h index 52787a3be..1af188cc7 100755 --- a/src/services/abstract/rootitem.h +++ b/src/services/abstract/rootitem.h @@ -37,7 +37,8 @@ namespace RootItemKind { Bin = 2, Feed = 4, Category = 8, - ServiceRoot = 16 + ServiceRoot = 16, + LabelsRoot = 32 }; inline Kind operator|(Kind a, Kind b) { diff --git a/src/services/standard/standardserviceroot.cpp b/src/services/standard/standardserviceroot.cpp index 2f94ac01a..0c0dfd2cd 100755 --- a/src/services/standard/standardserviceroot.cpp +++ b/src/services/standard/standardserviceroot.cpp @@ -27,6 +27,7 @@ #include "gui/messagebox.h" #include "exceptions/applicationexception.h" #include "services/abstract/recyclebin.h" +#include "services/abstract/labelsrootitem.h" #include "services/standard/standardserviceentrypoint.h" #include "services/standard/standardfeed.h" #include "services/standard/standardcategory.h" @@ -175,7 +176,10 @@ void StandardServiceRoot::loadFromDatabase(){ assembleFeeds(feeds); // As the last item, add recycle bin, which is needed. - appendChild(m_recycleBin); + appendChild(recycleBin()); + + //appendChild(new LabelsRootItem(this)); + updateCounts(true); }