mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-03 10:47:47 +01:00
Work on add account dialog.
This commit is contained in:
parent
01e595d7cd
commit
84fed7c4ce
@ -499,6 +499,16 @@ QList<ServiceRoot*> FeedsModel::serviceRoots() {
|
||||
return roots;
|
||||
}
|
||||
|
||||
bool FeedsModel::containsServiceRootFromEntryPoint(ServiceEntryPoint *point) {
|
||||
foreach (RootItem *root, serviceRoots()) {
|
||||
if (root->toServiceRoot()->code() == point->code()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
StandardServiceRoot *FeedsModel::standardServiceRoot() {
|
||||
foreach (RootItem *root, serviceRoots()) {
|
||||
StandardServiceRoot *std_service_root;
|
||||
|
@ -28,6 +28,7 @@ class DatabaseCleaner;
|
||||
class Category;
|
||||
class Feed;
|
||||
class ServiceRoot;
|
||||
class ServiceEntryPoint;
|
||||
class StandardServiceRoot;
|
||||
class QTimer;
|
||||
|
||||
@ -85,6 +86,9 @@ class FeedsModel : public QAbstractItemModel {
|
||||
// the model root item.
|
||||
QList<ServiceRoot*> serviceRoots();
|
||||
|
||||
// Determines if there is any account activated from given entry point.
|
||||
bool containsServiceRootFromEntryPoint(ServiceEntryPoint *point);
|
||||
|
||||
// Direct and the only global accessor to standard service root.
|
||||
// NOTE: Standard service root is always activated.
|
||||
StandardServiceRoot *standardServiceRoot();
|
||||
|
@ -38,6 +38,9 @@
|
||||
#define APP_USERAGENT QString("@APP_NAME@/@APP_VERSION@ (@APP_URL@) on @CMAKE_SYSTEM@")
|
||||
#define APP_DONATE_URL "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMWPLPK893VH4"
|
||||
|
||||
#define SERVICE_CODE_STD_RSS "std-rss"
|
||||
#define SERVICE_CODE_TT_RSS "tt-rss"
|
||||
|
||||
#define ENCLOSURES_OUTER_SEPARATOR '#'
|
||||
#define ECNLOSURES_INNER_SEPARATOR '&'
|
||||
#define URI_SCHEME_FEED "feed://"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
#include "core/feedsmodel.h"
|
||||
|
||||
#include "services/standard/standardserviceentrypoint.h"
|
||||
|
||||
#if defined(Q_OS_OS2)
|
||||
#include "gui/messagebox.h"
|
||||
@ -52,14 +52,24 @@ void FormAddAccount::displayActiveEntryPointDetails() {
|
||||
|
||||
if (!selected_items.isEmpty()) {
|
||||
ServiceEntryPoint *point = static_cast<ServiceEntryPoint*>(selected_items.at(0)->data(Qt::UserRole).value<void*>());
|
||||
|
||||
m_ui->m_txtAuthor->setText(point->author());
|
||||
m_ui->m_txtDescription->setText(point->description());
|
||||
m_ui->m_txtName->setText(point->name());
|
||||
m_ui->m_txtVersion->setText(point->version());
|
||||
}
|
||||
}
|
||||
|
||||
void FormAddAccount::loadEntryPoints() {
|
||||
foreach (ServiceEntryPoint *entry_point, m_entryPoints) {
|
||||
QListWidgetItem *item = new QListWidgetItem(entry_point->icon(), entry_point->name(), m_ui->m_listEntryPoints);
|
||||
|
||||
item->setData(Qt::UserRole, QVariant::fromValue((void*) entry_point));
|
||||
|
||||
if (entry_point->isSingleInstanceService() && m_model->containsServiceRootFromEntryPoint(entry_point)) {
|
||||
// Oops, this item cannot be added, it is single instance and is already added.
|
||||
item->setFlags(Qt::NoItemFlags);
|
||||
}
|
||||
}
|
||||
|
||||
m_ui->m_listEntryPoints->setCurrentRow(m_entryPoints.size() - 1);
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>558</width>
|
||||
<height>300</height>
|
||||
<width>610</width>
|
||||
<height>271</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -35,6 +35,70 @@
|
||||
<property name="title">
|
||||
<string>Details</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_txtName">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_txtVersion">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_txtAuthor">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QTextEdit" name="m_txtDescription">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
|
@ -44,12 +44,13 @@ class ServiceEntryPoint {
|
||||
// which operates with normal RSS/ATOM feeds.
|
||||
virtual bool isSingleInstanceService() = 0;
|
||||
|
||||
// Can properties of this service account be edited by user via GUI?
|
||||
virtual bool canBeEdited() = 0;
|
||||
|
||||
// Human readable service name, for example "TT-RSS".
|
||||
virtual QString name() = 0;
|
||||
|
||||
// Some arbitrary string.
|
||||
// NOTE: Keep in sync with ServiceRoot::code().
|
||||
virtual QString code() = 0;
|
||||
|
||||
// Human readable service description, for example "Services which offers TT-RSS integration.".
|
||||
virtual QString description() = 0;
|
||||
|
||||
|
@ -64,6 +64,8 @@ class ServiceRoot : public RootItem {
|
||||
virtual void start() = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
virtual QString code() = 0;
|
||||
|
||||
// This method should prepare messages for given "item" (download them maybe?)
|
||||
// into predefined "Messages" table
|
||||
// and then use method QSqlTableModel::setFilter(....).
|
||||
|
@ -33,12 +33,8 @@ bool StandardServiceEntryPoint::isSingleInstanceService() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StandardServiceEntryPoint::canBeEdited() {
|
||||
return false;
|
||||
}
|
||||
|
||||
QString StandardServiceEntryPoint::name() {
|
||||
return QSL("Standard (RSS/RDF/ATOM)");
|
||||
return QSL("Standard online feeds (RSS/RDF/ATOM)");
|
||||
}
|
||||
|
||||
QString StandardServiceEntryPoint::description() {
|
||||
@ -57,6 +53,10 @@ QIcon StandardServiceEntryPoint::icon() {
|
||||
return QIcon(APP_ICON_PATH);
|
||||
}
|
||||
|
||||
QString StandardServiceEntryPoint::code() {
|
||||
return SERVICE_CODE_STD_RSS;
|
||||
}
|
||||
|
||||
QList<ServiceRoot*> StandardServiceEntryPoint::initializeSubtree(FeedsModel *main_model) {
|
||||
StandardServiceRoot *root = new StandardServiceRoot(true, main_model);
|
||||
QList<ServiceRoot*> roots;
|
||||
|
@ -27,12 +27,12 @@ class StandardServiceEntryPoint : public ServiceEntryPoint {
|
||||
virtual ~StandardServiceEntryPoint();
|
||||
|
||||
bool isSingleInstanceService();
|
||||
bool canBeEdited();
|
||||
QString name();
|
||||
QString description();
|
||||
QString version();
|
||||
QString author();
|
||||
QIcon icon();
|
||||
QString code();
|
||||
|
||||
QList<ServiceRoot*> initializeSubtree(FeedsModel *main_model);
|
||||
};
|
||||
|
@ -101,6 +101,10 @@ void StandardServiceRoot::stop() {
|
||||
qDebug("Stopping StandardServiceRoot instance.");
|
||||
}
|
||||
|
||||
QString StandardServiceRoot::code() {
|
||||
return SERVICE_CODE_STD_RSS;
|
||||
}
|
||||
|
||||
bool StandardServiceRoot::canBeEdited() {
|
||||
return false;
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ class StandardServiceRoot : public ServiceRoot {
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
QString code();
|
||||
|
||||
bool canBeEdited();
|
||||
bool canBeDeleted();
|
||||
bool deleteViaGui();
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
|
||||
|
||||
TtRssServiceEntryPoint::TtRssServiceEntryPoint(){
|
||||
@ -33,20 +34,16 @@ bool TtRssServiceEntryPoint::isSingleInstanceService() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TtRssServiceEntryPoint::canBeEdited() {
|
||||
return true;
|
||||
}
|
||||
|
||||
QString TtRssServiceEntryPoint::name() {
|
||||
return QSL("TT-RSS (TinyTiny RSS)");
|
||||
return QSL("Tiny Tiny RSS");
|
||||
}
|
||||
|
||||
QString TtRssServiceEntryPoint::description() {
|
||||
return QSL("This service offers integration with TinyTiny RSS.");
|
||||
return QSL("This service offers integration with Tiny Tiny RSS.\n\nTiny Tiny RSS is an open source web-based news feed (RSS/Atom) reader and aggregator, designed to allow you to read news from any location, while feeling as close to a real desktop application as possible.");
|
||||
}
|
||||
|
||||
QString TtRssServiceEntryPoint::version() {
|
||||
return QSL("0.0.1");
|
||||
return QSL("0.0.2");
|
||||
}
|
||||
|
||||
QString TtRssServiceEntryPoint::author() {
|
||||
@ -54,7 +51,11 @@ QString TtRssServiceEntryPoint::author() {
|
||||
}
|
||||
|
||||
QIcon TtRssServiceEntryPoint::icon() {
|
||||
return QIcon(APP_ICON_PATH);
|
||||
return qApp->icons()->fromTheme(QSL("application-ttrss"));
|
||||
}
|
||||
|
||||
QString TtRssServiceEntryPoint::code() {
|
||||
return SERVICE_CODE_TT_RSS;
|
||||
}
|
||||
|
||||
QList<ServiceRoot*> TtRssServiceEntryPoint::initializeSubtree(FeedsModel *main_model) {
|
||||
|
@ -28,12 +28,12 @@ class TtRssServiceEntryPoint : public ServiceEntryPoint {
|
||||
virtual ~TtRssServiceEntryPoint();
|
||||
|
||||
bool isSingleInstanceService();
|
||||
bool canBeEdited();
|
||||
QString name();
|
||||
QString description();
|
||||
QString version();
|
||||
QString author();
|
||||
QIcon icon();
|
||||
QString code();
|
||||
|
||||
QList<ServiceRoot*> initializeSubtree(FeedsModel *main_model);
|
||||
};
|
||||
|
@ -33,6 +33,10 @@ TtRssServiceRoot::TtRssServiceRoot(FeedsModel *feeds_model, RootItem *parent) :
|
||||
TtRssServiceRoot::~TtRssServiceRoot() {
|
||||
}
|
||||
|
||||
QString TtRssServiceRoot::code() {
|
||||
return SERVICE_CODE_TT_RSS;
|
||||
}
|
||||
|
||||
bool TtRssServiceRoot::editViaGui() {
|
||||
return false;
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ class TtRssServiceRoot : public ServiceRoot {
|
||||
explicit TtRssServiceRoot(FeedsModel *feeds_model, RootItem *parent = NULL);
|
||||
virtual ~TtRssServiceRoot();
|
||||
|
||||
QString code();
|
||||
|
||||
bool canBeEdited();
|
||||
bool canBeDeleted();
|
||||
bool editViaGui();
|
||||
|
Loading…
x
Reference in New Issue
Block a user