Fix some obsoletes, fix bug #231.

This commit is contained in:
Martin Rotter 2020-04-21 08:43:30 +02:00
parent e1949c8628
commit 172dc793a8
8 changed files with 61 additions and 2 deletions

View file

@ -12,6 +12,7 @@
<file>./graphics/Faenza/actions/64/document-revert.png</file> <file>./graphics/Faenza/actions/64/document-revert.png</file>
<file>./graphics/Faenza/actions/64/down.png</file> <file>./graphics/Faenza/actions/64/down.png</file>
<file>./graphics/Faenza/actions/64/edit-clear.png</file> <file>./graphics/Faenza/actions/64/edit-clear.png</file>
<file>./graphics/Faenza/actions/64/edit-copy.png</file>
<file>./graphics/Faenza/actions/64/format-indent-more.png</file> <file>./graphics/Faenza/actions/64/format-indent-more.png</file>
<file>./graphics/Faenza/actions/64/format-justify-fill.png</file> <file>./graphics/Faenza/actions/64/format-justify-fill.png</file>
<file>./graphics/Faenza/actions/64/forward.png</file> <file>./graphics/Faenza/actions/64/forward.png</file>

0
resources/scripts/.generate-used-icons.sh Normal file → Executable file
View file

23
src/librssguard/gui/dialogs/formmain.cpp Normal file → Executable file
View file

@ -41,6 +41,10 @@
#include <QThread> #include <QThread>
#include <QTimer> #include <QTimer>
#if QT_VERSION >= 0x050E00 // Qt >= 5.14.0
#include <QScreen>
#endif
#if defined (USE_WEBENGINE) #if defined (USE_WEBENGINE)
#include "network-web/adblock/adblockicon.h" #include "network-web/adblock/adblockicon.h"
#include "network-web/adblock/adblockmanager.h" #include "network-web/adblock/adblockmanager.h"
@ -164,6 +168,7 @@ QList<QAction*> FormMain::allActions() const {
actions << m_ui->m_actionUpdateSelectedItems; actions << m_ui->m_actionUpdateSelectedItems;
actions << m_ui->m_actionStopRunningItemsUpdate; actions << m_ui->m_actionStopRunningItemsUpdate;
actions << m_ui->m_actionEditSelectedItem; actions << m_ui->m_actionEditSelectedItem;
actions << m_ui->m_actionCopyUrlSelectedFeed;
actions << m_ui->m_actionDeleteSelectedItem; actions << m_ui->m_actionDeleteSelectedItem;
actions << m_ui->m_actionServiceAdd; actions << m_ui->m_actionServiceAdd;
actions << m_ui->m_actionServiceEdit; actions << m_ui->m_actionServiceEdit;
@ -374,7 +379,7 @@ void FormMain::onFeedUpdatesStarted() {
} }
void FormMain::onFeedUpdatesProgress(const Feed* feed, int current, int total) { void FormMain::onFeedUpdatesProgress(const Feed* feed, int current, int total) {
statusBar()->showProgressFeeds((current * 100.0) / total, statusBar()->showProgressFeeds(int((current * 100.0) / total),
//: Text display in status bar when particular feed is updated. //: Text display in status bar when particular feed is updated.
tr("Updated feed '%1'").arg(feed->title())); tr("Updated feed '%1'").arg(feed->title()));
@ -411,6 +416,7 @@ void FormMain::updateFeedButtonsAvailability() {
m_ui->m_actionClearSelectedItems->setEnabled(anything_selected); m_ui->m_actionClearSelectedItems->setEnabled(anything_selected);
m_ui->m_actionDeleteSelectedItem->setEnabled(!critical_action_running && anything_selected); m_ui->m_actionDeleteSelectedItem->setEnabled(!critical_action_running && anything_selected);
m_ui->m_actionEditSelectedItem->setEnabled(!critical_action_running && anything_selected); m_ui->m_actionEditSelectedItem->setEnabled(!critical_action_running && anything_selected);
m_ui->m_actionCopyUrlSelectedFeed->setEnabled(service_selected || feed_selected || category_selected);
m_ui->m_actionMarkSelectedItemsAsRead->setEnabled(anything_selected); m_ui->m_actionMarkSelectedItemsAsRead->setEnabled(anything_selected);
m_ui->m_actionMarkSelectedItemsAsUnread->setEnabled(anything_selected); m_ui->m_actionMarkSelectedItemsAsUnread->setEnabled(anything_selected);
m_ui->m_actionUpdateAllItems->setEnabled(!critical_action_running); m_ui->m_actionUpdateAllItems->setEnabled(!critical_action_running);
@ -492,6 +498,7 @@ void FormMain::setupIcons() {
m_ui->m_actionDeleteSelectedItem->setIcon(icon_theme_factory->fromTheme(QSL("list-remove"))); m_ui->m_actionDeleteSelectedItem->setIcon(icon_theme_factory->fromTheme(QSL("list-remove")));
m_ui->m_actionDeleteSelectedMessages->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-junk"))); m_ui->m_actionDeleteSelectedMessages->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-junk")));
m_ui->m_actionEditSelectedItem->setIcon(icon_theme_factory->fromTheme(QSL("document-edit"))); m_ui->m_actionEditSelectedItem->setIcon(icon_theme_factory->fromTheme(QSL("document-edit")));
m_ui->m_actionCopyUrlSelectedFeed->setIcon(icon_theme_factory->fromTheme(QSL("edit-copy")));
m_ui->m_actionMarkAllItemsRead->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-read"))); m_ui->m_actionMarkAllItemsRead->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-read")));
m_ui->m_actionMarkSelectedItemsAsRead->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-read"))); m_ui->m_actionMarkSelectedItemsAsRead->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-read")));
m_ui->m_actionMarkSelectedItemsAsUnread->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-unread"))); m_ui->m_actionMarkSelectedItemsAsUnread->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-unread")));
@ -530,7 +537,19 @@ void FormMain::setupIcons() {
} }
void FormMain::loadSize() { void FormMain::loadSize() {
#if QT_VERSION >= 0x050E00 // Qt >= 5.14.0
QScreen* scr = screen();
if (scr == nullptr) {
qWarning("Cannot load dialog size, because no screens are detected.");
return;
}
const QRect screen = scr->geometry();
#else
const QRect screen = qApp->desktop()->screenGeometry(); const QRect screen = qApp->desktop()->screenGeometry();
#endif
const Settings* settings = qApp->settings(); const Settings* settings = qApp->settings();
// Reload main window size & position. // Reload main window size & position.
@ -694,6 +713,8 @@ void FormMain::createConnections() {
&QAction::triggered, qApp->feedReader(), &FeedReader::updateAllFeeds); &QAction::triggered, qApp->feedReader(), &FeedReader::updateAllFeeds);
connect(m_ui->m_actionStopRunningItemsUpdate, connect(m_ui->m_actionStopRunningItemsUpdate,
&QAction::triggered, qApp->feedReader(), &FeedReader::stopRunningFeedUpdate); &QAction::triggered, qApp->feedReader(), &FeedReader::stopRunningFeedUpdate);
connect(m_ui->m_actionCopyUrlSelectedFeed,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::copyUrlOfSelectedFeeds);
connect(m_ui->m_actionEditSelectedItem, connect(m_ui->m_actionEditSelectedItem,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::editSelectedItem); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::editSelectedItem);
connect(m_ui->m_actionViewSelectedItemsNewspaperMode, connect(m_ui->m_actionViewSelectedItemsNewspaperMode,

8
src/librssguard/gui/dialogs/formmain.ui Normal file → Executable file
View file

@ -45,7 +45,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1296</width> <width>1296</width>
<height>21</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="m_menuFile"> <widget class="QMenu" name="m_menuFile">
@ -122,6 +122,7 @@
<addaction name="m_actionMarkAllItemsRead"/> <addaction name="m_actionMarkAllItemsRead"/>
<addaction name="m_actionClearAllItems"/> <addaction name="m_actionClearAllItems"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="m_actionCopyUrlSelectedFeed"/>
<addaction name="m_actionViewSelectedItemsNewspaperMode"/> <addaction name="m_actionViewSelectedItemsNewspaperMode"/>
<addaction name="m_actionMarkSelectedItemsAsRead"/> <addaction name="m_actionMarkSelectedItemsAsRead"/>
<addaction name="m_actionMarkSelectedItemsAsUnread"/> <addaction name="m_actionMarkSelectedItemsAsUnread"/>
@ -744,6 +745,11 @@
<string>&amp;Enable message preview</string> <string>&amp;Enable message preview</string>
</property> </property>
</action> </action>
<action name="m_actionCopyUrlSelectedFeed">
<property name="text">
<string>&amp;Copy URLs of selected items</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

19
src/librssguard/gui/feedsview.cpp Normal file → Executable file
View file

@ -19,6 +19,7 @@
#include "services/standard/standardcategory.h" #include "services/standard/standardcategory.h"
#include "services/standard/standardfeed.h" #include "services/standard/standardfeed.h"
#include <QClipboard>
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QHeaderView> #include <QHeaderView>
#include <QMenu> #include <QMenu>
@ -127,6 +128,21 @@ void FeedsView::loadAllExpandStates() {
static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderFeeds)).toInt())); static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderFeeds)).toInt()));
} }
void FeedsView::copyUrlOfSelectedFeeds() const {
auto feeds = selectedFeeds();
QStringList urls;
for (const auto* feed : feeds) {
if (!feed->url().isEmpty()) {
urls << feed->url();
}
}
if (qApp->clipboard() != nullptr && !urls.isEmpty()) {
qApp->clipboard()->setText(urls.join(TextFactory::newline()));
}
}
void FeedsView::sortByColumn(int column, Qt::SortOrder order) { void FeedsView::sortByColumn(int column, Qt::SortOrder order) {
const int old_column = header()->sortIndicatorSection(); const int old_column = header()->sortIndicatorSection();
const Qt::SortOrder old_order = header()->sortIndicatorOrder(); const Qt::SortOrder old_order = header()->sortIndicatorOrder();
@ -441,6 +457,7 @@ QMenu* FeedsView::initializeContextMenuService(RootItem* clicked_item) {
m_contextMenuService->addActions(QList<QAction*>() << m_contextMenuService->addActions(QList<QAction*>() <<
qApp->mainForm()->m_ui->m_actionUpdateSelectedItems << qApp->mainForm()->m_ui->m_actionUpdateSelectedItems <<
qApp->mainForm()->m_ui->m_actionEditSelectedItem << qApp->mainForm()->m_ui->m_actionEditSelectedItem <<
qApp->mainForm()->m_ui->m_actionCopyUrlSelectedFeed <<
qApp->mainForm()->m_ui->m_actionViewSelectedItemsNewspaperMode << qApp->mainForm()->m_ui->m_actionViewSelectedItemsNewspaperMode <<
qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsRead << qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsRead <<
qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsUnread << qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsUnread <<
@ -484,6 +501,7 @@ QMenu* FeedsView::initializeContextMenuCategories(RootItem* clicked_item) {
m_contextMenuCategories->addActions(QList<QAction*>() << m_contextMenuCategories->addActions(QList<QAction*>() <<
qApp->mainForm()->m_ui->m_actionUpdateSelectedItems << qApp->mainForm()->m_ui->m_actionUpdateSelectedItems <<
qApp->mainForm()->m_ui->m_actionEditSelectedItem << qApp->mainForm()->m_ui->m_actionEditSelectedItem <<
qApp->mainForm()->m_ui->m_actionCopyUrlSelectedFeed <<
qApp->mainForm()->m_ui->m_actionViewSelectedItemsNewspaperMode << qApp->mainForm()->m_ui->m_actionViewSelectedItemsNewspaperMode <<
qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsRead << qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsRead <<
qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsUnread << qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsUnread <<
@ -509,6 +527,7 @@ QMenu* FeedsView::initializeContextMenuFeeds(RootItem* clicked_item) {
m_contextMenuFeeds->addActions(QList<QAction*>() << m_contextMenuFeeds->addActions(QList<QAction*>() <<
qApp->mainForm()->m_ui->m_actionUpdateSelectedItems << qApp->mainForm()->m_ui->m_actionUpdateSelectedItems <<
qApp->mainForm()->m_ui->m_actionEditSelectedItem << qApp->mainForm()->m_ui->m_actionEditSelectedItem <<
qApp->mainForm()->m_ui->m_actionCopyUrlSelectedFeed <<
qApp->mainForm()->m_ui->m_actionViewSelectedItemsNewspaperMode << qApp->mainForm()->m_ui->m_actionViewSelectedItemsNewspaperMode <<
qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsRead << qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsRead <<
qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsUnread << qApp->mainForm()->m_ui->m_actionMarkSelectedItemsAsUnread <<

1
src/librssguard/gui/feedsview.h Normal file → Executable file
View file

@ -48,6 +48,7 @@ class RSSGUARD_DLLSPEC FeedsView : public QTreeView {
void loadAllExpandStates(); void loadAllExpandStates();
public slots: public slots:
void copyUrlOfSelectedFeeds() const;
void sortByColumn(int column, Qt::SortOrder order); void sortByColumn(int column, Qt::SortOrder order);
void addFeedIntoSelectedAccount(); void addFeedIntoSelectedAccount();

10
src/librssguard/miscellaneous/textfactory.cpp Normal file → Executable file
View file

@ -114,6 +114,16 @@ QString TextFactory::decrypt(const QString& text) {
return SimpleCrypt(initializeSecretEncryptionKey()).decryptToString(text); return SimpleCrypt(initializeSecretEncryptionKey()).decryptToString(text);
} }
QString TextFactory::newline() {
#if defined(Q_OS_WIN)
return QSL("\r\n");
#elif defined(Q_OS_MACOS)
return QSL("\r");
#else
return QSL("\n");
#endif
}
QString TextFactory::shorten(const QString& input, int text_length_limit) { QString TextFactory::shorten(const QString& input, int text_length_limit) {
if (input.size() > text_length_limit) { if (input.size() > text_length_limit) {
return input.left(text_length_limit - ELLIPSIS_LENGTH) + QString(ELLIPSIS_LENGTH, QL1C('.')); return input.left(text_length_limit - ELLIPSIS_LENGTH) + QString(ELLIPSIS_LENGTH, QL1C('.'));

1
src/librssguard/miscellaneous/textfactory.h Normal file → Executable file
View file

@ -34,6 +34,7 @@ class TextFactory {
static QDateTime parseDateTime(qint64 milis_from_epoch); static QDateTime parseDateTime(qint64 milis_from_epoch);
static QString encrypt(const QString& text); static QString encrypt(const QString& text);
static QString decrypt(const QString& text); static QString decrypt(const QString& text);
static QString newline();
// Shortens input string according to given length limit. // Shortens input string according to given length limit.
static QString shorten(const QString& input, int text_length_limit = TEXT_TITLE_LIMIT); static QString shorten(const QString& input, int text_length_limit = TEXT_TITLE_LIMIT);