fixed #824
This commit is contained in:
parent
d99ad7f628
commit
b6269bf0e6
@ -395,6 +395,8 @@ set(SOURCES
|
||||
services/standard/gui/formstandardimportexport.h
|
||||
services/standard/gui/standardfeeddetails.cpp
|
||||
services/standard/gui/standardfeeddetails.h
|
||||
services/standard/gui/standardaccountdetails.cpp
|
||||
services/standard/gui/standardaccountdetails.h
|
||||
services/standard/parsers/atomparser.cpp
|
||||
services/standard/parsers/atomparser.h
|
||||
services/standard/parsers/feedparser.cpp
|
||||
@ -490,6 +492,7 @@ set(UI_FILES
|
||||
services/standard/gui/formdiscoverfeeds.ui
|
||||
services/standard/gui/formstandardimportexport.ui
|
||||
services/standard/gui/standardfeeddetails.ui
|
||||
services/standard/gui/standardaccountdetails.ui
|
||||
services/tt-rss/gui/formttrssnote.ui
|
||||
services/tt-rss/gui/ttrssaccountdetails.ui
|
||||
services/tt-rss/gui/ttrssfeeddetails.ui
|
||||
|
@ -1,6 +1,6 @@
|
||||
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||
|
||||
#include "accountdetails.h"
|
||||
#include "services/abstract/gui/accountdetails.h"
|
||||
|
||||
AccountDetails::AccountDetails(QWidget* parent) : QWidget(parent) {
|
||||
m_ui.setupUi(this);
|
||||
|
@ -2,14 +2,36 @@
|
||||
|
||||
#include "services/standard/gui/formeditstandardaccount.h"
|
||||
|
||||
#include "services/standard/gui/standardaccountdetails.h"
|
||||
#include "services/standard/standardserviceentrypoint.h"
|
||||
#include "services/standard/standardserviceroot.h"
|
||||
|
||||
FormEditStandardAccount::FormEditStandardAccount(QWidget* parent)
|
||||
: FormAccountDetails(StandardServiceEntryPoint().icon(), parent) {}
|
||||
: FormAccountDetails(StandardServiceEntryPoint().icon(), parent),
|
||||
m_standardDetails(new StandardAccountDetails(this)) {
|
||||
|
||||
insertCustomTab(m_standardDetails, tr("Account setup"), 0);
|
||||
activateTab(0);
|
||||
}
|
||||
|
||||
void FormEditStandardAccount::loadAccountData() {
|
||||
FormAccountDetails::loadAccountData();
|
||||
|
||||
if (m_creatingNew) {
|
||||
m_standardDetails->m_ui.m_txtTitle->setText(StandardServiceRoot::defaultTitle());
|
||||
}
|
||||
else {
|
||||
m_standardDetails->m_ui.m_txtTitle->setText(m_account->title());
|
||||
}
|
||||
}
|
||||
|
||||
void FormEditStandardAccount::apply() {
|
||||
FormAccountDetails::apply();
|
||||
|
||||
m_account->setTitle(m_standardDetails->m_ui.m_txtTitle->text());
|
||||
|
||||
m_account->saveAccountDataToDatabase();
|
||||
m_account->itemChanged({m_account});
|
||||
|
||||
accept();
|
||||
}
|
||||
|
@ -5,14 +5,22 @@
|
||||
|
||||
#include "services/abstract/gui/formaccountdetails.h"
|
||||
|
||||
class StandardAccountDetails;
|
||||
|
||||
class FormEditStandardAccount : public FormAccountDetails {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormEditStandardAccount(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
virtual void loadAccountData();
|
||||
|
||||
protected slots:
|
||||
virtual void apply();
|
||||
|
||||
private:
|
||||
StandardAccountDetails* m_standardDetails;
|
||||
};
|
||||
|
||||
#endif // FORMEDITSTANDARDACCOUNT_H
|
||||
|
@ -0,0 +1,7 @@
|
||||
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||
|
||||
#include "services/standard/gui/standardaccountdetails.h"
|
||||
|
||||
StandardAccountDetails::StandardAccountDetails(QWidget* parent) : QWidget(parent) {
|
||||
m_ui.setupUi(this);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||
|
||||
#ifndef STANDARDACCOUNTDETAILS_H
|
||||
#define STANDARDACCOUNTDETAILS_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ui_standardaccountdetails.h"
|
||||
|
||||
namespace Ui {
|
||||
class StandardAccountDetails;
|
||||
}
|
||||
|
||||
class StandardAccountDetails : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
friend class FormEditStandardAccount;
|
||||
|
||||
public:
|
||||
explicit StandardAccountDetails(QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
Ui::StandardAccountDetails m_ui;
|
||||
};
|
||||
|
||||
#endif // STANDARDACCOUNTDETAILS_H
|
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StandardAccountDetails</class>
|
||||
<widget class="QWidget" name="StandardAccountDetails">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_txtTitle"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -39,7 +39,6 @@
|
||||
#include <QTextCodec>
|
||||
|
||||
StandardServiceRoot::StandardServiceRoot(RootItem* parent) : ServiceRoot(parent) {
|
||||
setTitle(qApp->system()->loggedInUser() + QSL(" (RSS/ATOM/JSON)"));
|
||||
setIcon(StandardServiceEntryPoint().icon());
|
||||
setDescription(tr("This is the obligatory service account for standard RSS/RDF/ATOM feeds."));
|
||||
}
|
||||
@ -352,6 +351,24 @@ QList<QAction*> StandardServiceRoot::getContextMenuForFeed(StandardFeed* feed) {
|
||||
return m_feedContextMenu;
|
||||
}
|
||||
|
||||
QVariantHash StandardServiceRoot::customDatabaseData() const {
|
||||
QVariantHash data = ServiceRoot::customDatabaseData();
|
||||
|
||||
data[QSL("title")] = title();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void StandardServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
ServiceRoot::setCustomDatabaseData(data);
|
||||
|
||||
setTitle(data.value(QSL("title"), defaultTitle()).toString());
|
||||
}
|
||||
|
||||
QString StandardServiceRoot::defaultTitle() {
|
||||
return qApp->system()->loggedInUser() + QSL(" (RSS/ATOM/JSON)");
|
||||
}
|
||||
|
||||
bool StandardServiceRoot::mergeImportExportModel(FeedsImportExportModel* model,
|
||||
RootItem* target_root_node,
|
||||
QString& output_message) {
|
||||
|
@ -34,6 +34,8 @@ class StandardServiceRoot : public ServiceRoot {
|
||||
virtual bool supportsFeedAdding() const;
|
||||
virtual bool supportsCategoryAdding() const;
|
||||
virtual Qt::ItemFlags additionalFlags() const;
|
||||
virtual QVariantHash customDatabaseData() const;
|
||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||
virtual QList<Message> obtainNewMessages(Feed* feed,
|
||||
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
|
||||
const QHash<QString, QStringList>& tagged_messages);
|
||||
@ -41,6 +43,8 @@ class StandardServiceRoot : public ServiceRoot {
|
||||
QList<QAction*> serviceMenu();
|
||||
QList<QAction*> getContextMenuForFeed(StandardFeed* feed);
|
||||
|
||||
static QString defaultTitle();
|
||||
|
||||
public slots:
|
||||
void addNewFeed(RootItem* selected_item, const QString& url = QString());
|
||||
void addNewCategory(RootItem* selected_item);
|
||||
|
Loading…
x
Reference in New Issue
Block a user