Some more changes to entry points.

This commit is contained in:
Martin Rotter 2015-11-24 10:52:53 +01:00
parent bd6c5390b4
commit cfabf56e44
8 changed files with 16 additions and 49 deletions

View File

@ -390,7 +390,7 @@ QList<ServiceRoot*> FeedsModel::serviceRoots() {
}
StandardServiceRoot *FeedsModel::standardServiceRoot() {
foreach (RootItem *root, m_rootItem->childItems()) {
foreach (RootItem *root, serviceRoots()) {
StandardServiceRoot *std_service_root;
if ((std_service_root = dynamic_cast<StandardServiceRoot*>(root)) != NULL) {

View File

@ -39,6 +39,8 @@ class FeedsModel : public QAbstractItemModel {
explicit FeedsModel(QObject *parent = 0);
virtual ~FeedsModel();
DatabaseCleaner *databaseCleaner();
// Model implementation.
inline QVariant data(const QModelIndex &index, int role) const {
// Return data according to item.
@ -139,8 +141,6 @@ class FeedsModel : public QAbstractItemModel {
// Schedules all feeds from all accounts for update.
void updateAllFeeds();
DatabaseCleaner *databaseCleaner();
// Adds given service root account.
bool addServiceAccount(ServiceRoot *root);

View File

@ -215,7 +215,19 @@ void WebBrowser::onIconChanged() {
void WebBrowser::addFeedFromWebsite(const QString &feed_link) {
qApp->clipboard()->setText(feed_link);
qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->standardServiceRoot()->addNewFeed();
StandardServiceRoot *service = qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->standardServiceRoot();
if (service != NULL) {
service->addNewFeed();
}
else {
qApp->showGuiMessage(tr("Cannot add feed"),
tr("You cannot add this feed to %1 because standard RSS/ATOM account is not enabled. Enable it first.").arg(APP_NAME),
QSystemTrayIcon::Warning,
qApp->mainForm(),
true);
}
}
void WebBrowser::onTitleChanged(const QString &new_title) {

View File

@ -39,26 +39,11 @@ class ServiceEntryPoint {
// to the global feed model.
virtual QList<ServiceRoot*> initializeSubtree(FeedsModel *main_model) = 0;
// Must this service account be activated by default?
// NOTE: This is true particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool isDefaultService() = 0;
// Can this service account be added just once?
// NOTE: This is true particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool isSingleInstanceService() = 0;
// Can this service account be added by user via GUI?
// NOTE: This is true particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool canBeAdded() = 0;
// Can this service account by deleted by user via GUI?
// NOTE: This is false particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool canBeDeleted() = 0;
// Can properties of this service account be edited by user via GUI?
virtual bool canBeEdited() = 0;

View File

@ -29,22 +29,10 @@ StandardServiceEntryPoint::StandardServiceEntryPoint() {
StandardServiceEntryPoint::~StandardServiceEntryPoint() {
}
bool StandardServiceEntryPoint::isDefaultService() {
return true;
}
bool StandardServiceEntryPoint::isSingleInstanceService() {
return true;
}
bool StandardServiceEntryPoint::canBeAdded() {
return false;
}
bool StandardServiceEntryPoint::canBeDeleted() {
return false;
}
bool StandardServiceEntryPoint::canBeEdited() {
return false;
}

View File

@ -26,10 +26,7 @@ class StandardServiceEntryPoint : public ServiceEntryPoint {
explicit StandardServiceEntryPoint();
virtual ~StandardServiceEntryPoint();
bool isDefaultService();
bool isSingleInstanceService();
bool canBeAdded();
bool canBeDeleted();
bool canBeEdited();
QString name();
QString description();

View File

@ -29,22 +29,10 @@ TtRssServiceEntryPoint::~TtRssServiceEntryPoint() {
}
bool TtRssServiceEntryPoint::isDefaultService() {
return false;
}
bool TtRssServiceEntryPoint::isSingleInstanceService() {
return false;
}
bool TtRssServiceEntryPoint::canBeAdded() {
return true;
}
bool TtRssServiceEntryPoint::canBeDeleted() {
return true;
}
bool TtRssServiceEntryPoint::canBeEdited() {
return true;
}

View File

@ -27,10 +27,7 @@ class TtRssServiceEntryPoint : public ServiceEntryPoint {
explicit TtRssServiceEntryPoint();
virtual ~TtRssServiceEntryPoint();
bool isDefaultService();
bool isSingleInstanceService();
bool canBeAdded();
bool canBeDeleted();
bool canBeEdited();
QString name();
QString description();