diff --git a/src/core/feedsselection.cpp b/src/core/feedsselection.cpp index d75862da8..5ca545f59 100644 --- a/src/core/feedsselection.cpp +++ b/src/core/feedsselection.cpp @@ -1,3 +1,20 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2015 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 "core/feedsselection.h" #include "core/feedsmodelrootitem.h" @@ -15,21 +32,21 @@ FeedsSelection::FeedsSelection(const FeedsSelection &other) { FeedsSelection::~FeedsSelection() { } -FeedsSelection::MessageMode FeedsSelection::mode() { +FeedsSelection::SelectionMode FeedsSelection::mode() { if (m_selectedItem == NULL) { - return MessageMode::NoMode; + return SelectionMode::NoMode; } switch (m_selectedItem->kind()) { case FeedsModelRootItem::RecycleBin: - return MessageMode::MessagesFromRecycleBin; + return SelectionMode::MessagesFromRecycleBin; case FeedsModelRootItem::Category: case FeedsModelRootItem::Feed: - return MessageMode::MessagesFromFeeds; + return SelectionMode::MessagesFromFeeds; default: - return MessageMode::NoMode; + return SelectionMode::NoMode; } } diff --git a/src/core/feedsselection.h b/src/core/feedsselection.h index 970d21a5d..9ff8d4d0d 100644 --- a/src/core/feedsselection.h +++ b/src/core/feedsselection.h @@ -1,3 +1,20 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2015 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 FEEDSSELECTION_H #define FEEDSSELECTION_H @@ -9,7 +26,7 @@ class FeedsModelRootItem; class FeedsSelection { public: - enum MessageMode { + enum SelectionMode { NoMode, MessagesFromFeeds, MessagesFromRecycleBin @@ -19,7 +36,7 @@ class FeedsSelection { FeedsSelection(const FeedsSelection &other); virtual ~FeedsSelection(); - MessageMode mode(); + SelectionMode mode(); FeedsModelRootItem *selectedItem() const; QString generateListOfIds(); @@ -27,6 +44,6 @@ class FeedsSelection { FeedsModelRootItem *m_selectedItem; }; -Q_DECLARE_METATYPE(FeedsSelection::MessageMode) +Q_DECLARE_METATYPE(FeedsSelection::SelectionMode) #endif // FEEDSSELECTION_H diff --git a/src/core/messagesmodel.cpp b/src/core/messagesmodel.cpp index ec8159ec0..2f909aa72 100755 --- a/src/core/messagesmodel.cpp +++ b/src/core/messagesmodel.cpp @@ -170,7 +170,6 @@ QVariant MessagesModel::data(const QModelIndex &idx, int role) const { if (m_customDateFormat.isEmpty()) { return TextFactory::parseDateTime(QSqlTableModel::data(idx, role).value()).toLocalTime().toString(Qt::DefaultLocaleShortDate); - } else { return TextFactory::parseDateTime(QSqlTableModel::data(idx, role).value()).toLocalTime().toString(m_customDateFormat); @@ -181,11 +180,6 @@ QVariant MessagesModel::data(const QModelIndex &idx, int role) const { return author_name.isEmpty() ? "-" : author_name; } - /* - else if (index_column == MSG_DB_ID_INDEX) { - return QSqlTableModel::data(index(idx.row(), MSG_DB_TITLE_INDEX, idx.parent())); - } - */ else if (index_column != MSG_DB_IMPORTANT_INDEX && index_column != MSG_DB_READ_INDEX) { return QSqlTableModel::data(idx, role); } diff --git a/src/core/messagesmodel.h b/src/core/messagesmodel.h index 2799f8e64..ff3b98d88 100755 --- a/src/core/messagesmodel.h +++ b/src/core/messagesmodel.h @@ -138,7 +138,7 @@ class MessagesModel : public QSqlTableModel { signals: // Emitted if some persistent change is made which affects count of "unread/all" messages. - void messageCountsChanged(FeedsSelection::MessageMode mode, bool total_msg_count_changed, bool any_msg_restored); + void messageCountsChanged(FeedsSelection::SelectionMode mode, bool total_msg_count_changed, bool any_msg_restored); protected: // Sets up header data. diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index 0002a3555..4476b0eba 100755 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -200,8 +200,8 @@ void FeedMessageViewer::createConnections() { connect(m_feedsView, SIGNAL(feedsSelected(FeedsSelection)), m_messagesView, SLOT(loadFeeds(FeedsSelection))); // If user changes status of some messages, recalculate message counts. - connect(m_messagesView->sourceModel(), SIGNAL(messageCountsChanged(FeedsSelection::MessageMode,bool,bool)), - m_feedsView, SLOT(receiveMessageCountsChange(FeedsSelection::MessageMode,bool,bool))); + connect(m_messagesView->sourceModel(), SIGNAL(messageCountsChanged(FeedsSelection::SelectionMode,bool,bool)), + m_feedsView, SLOT(receiveMessageCountsChange(FeedsSelection::SelectionMode,bool,bool))); // State of many messages is changed, then we need // to reload selections. diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index 04872593e..d4d382b37 100755 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -310,7 +310,7 @@ void FeedsView::editFeed(FeedsModelFeed *feed) { delete form_pointer.data(); } -void FeedsView::receiveMessageCountsChange(FeedsSelection::MessageMode mode, +void FeedsView::receiveMessageCountsChange(FeedsSelection::SelectionMode mode, bool total_msg_count_changed, bool any_msg_restored) { // If the change came from recycle bin mode, then: diff --git a/src/gui/feedsview.h b/src/gui/feedsview.h index 7887bd8ba..511d5dd68 100644 --- a/src/gui/feedsview.h +++ b/src/gui/feedsview.h @@ -117,7 +117,7 @@ class FeedsView : public QTreeView { // Is called when counts of messages are changed externally, // typically from message view. - void receiveMessageCountsChange(FeedsSelection::MessageMode mode, bool total_msg_count_changed, bool any_msg_restored); + void receiveMessageCountsChange(FeedsSelection::SelectionMode mode, bool total_msg_count_changed, bool any_msg_restored); // Reloads counts for selected feeds. void updateCountsOfSelectedFeeds(bool update_total_too); diff --git a/src/network-web/downloadmanager.cpp b/src/network-web/downloadmanager.cpp index e408f861c..5b086a430 100644 --- a/src/network-web/downloadmanager.cpp +++ b/src/network-web/downloadmanager.cpp @@ -202,7 +202,10 @@ void DownloadItem::stop() { } void DownloadItem::openFile() { - QDesktopServices::openUrl(QUrl::fromLocalFile(m_output.fileName())); + if (!QDesktopServices::openUrl(QUrl::fromLocalFile(m_output.fileName()))) { + MessageBox::show(this, QMessageBox::Warning, tr("Cannot open file"), tr("Cannot open output file. Open it manually."), + QString(), QDir::toNativeSeparators(m_output.fileName())); + } } void DownloadItem::openFolder() {