Some cleanups.

This commit is contained in:
Martin Rotter 2016-02-16 06:35:47 +01:00
parent a90e4880d0
commit d76e5eb345
8 changed files with 47 additions and 41 deletions

View File

@ -85,6 +85,18 @@ bool ServiceRoot::markAsReadUnread(RootItem::ReadStatus status) {
} }
} }
QList<QAction*> ServiceRoot::addItemMenu() {
return QList<QAction*>();
}
QList<QAction*> ServiceRoot::contextMenu() {
return serviceMenu();
}
QList<QAction*> ServiceRoot::serviceMenu() {
return QList<QAction*>();
}
QList<Message> ServiceRoot::undeletedMessages() const { QList<Message> ServiceRoot::undeletedMessages() const {
QList<Message> messages; QList<Message> messages;
const int account_id = accountId(); const int account_id = accountId();

View File

@ -60,12 +60,14 @@ class ServiceRoot : public RootItem {
// b) Add new category // b) Add new category
// c) ... // c) ...
// NOTE: Caller does NOT take ownership of created menu! // NOTE: Caller does NOT take ownership of created menu!
virtual QList<QAction*> addItemMenu() = 0; virtual QList<QAction*> addItemMenu();
QList<QAction*> contextMenu();
// Returns list of specific actions to be shown in main window menu // Returns list of specific actions to be shown in main window menu
// bar in sections "Services -> 'this service'". // bar in sections "Services -> 'this service'".
// NOTE: Caller does NOT take ownership of created menu! // NOTE: Caller does NOT take ownership of created menu!
virtual QList<QAction*> serviceMenu() = 0; virtual QList<QAction*> serviceMenu();
// Access to recycle bin of this account if there is any. // Access to recycle bin of this account if there is any.
virtual RecycleBin *recycleBin() const = 0; virtual RecycleBin *recycleBin() const = 0;

View File

@ -461,10 +461,6 @@ void StandardServiceRoot::exportFeeds() {
form.data()->exec(); form.data()->exec();
} }
QList<QAction*> StandardServiceRoot::addItemMenu() {
return QList<QAction*>();
}
QList<QAction*> StandardServiceRoot::serviceMenu() { QList<QAction*> StandardServiceRoot::serviceMenu() {
if (m_serviceMenu.isEmpty()) { if (m_serviceMenu.isEmpty()) {
m_actionExportFeeds = new QAction(qApp->icons()->fromTheme("document-export"), tr("Export feeds"), this); m_actionExportFeeds = new QAction(qApp->icons()->fromTheme("document-export"), tr("Export feeds"), this);
@ -479,7 +475,3 @@ QList<QAction*> StandardServiceRoot::serviceMenu() {
return m_serviceMenu; return m_serviceMenu;
} }
QList<QAction*> StandardServiceRoot::contextMenu() {
return serviceMenu();
}

View File

@ -58,15 +58,9 @@ class StandardServiceRoot : public ServiceRoot {
// Access to recycle bin. // Access to recycle bin.
RecycleBin *recycleBin() const; RecycleBin *recycleBin() const;
// Return "add feed" and "add category" items.
QList<QAction*> addItemMenu();
// Returns menu to be shown in "Services -> service" menu. // Returns menu to be shown in "Services -> service" menu.
QList<QAction*> serviceMenu(); QList<QAction*> serviceMenu();
// Returns context menu.
QList<QAction*> contextMenu();
// Returns context specific menu actions for given feed. // Returns context specific menu actions for given feed.
QList<QAction*> getContextMenuForFeed(StandardFeed *feed); QList<QAction*> getContextMenuForFeed(StandardFeed *feed);

View File

@ -33,6 +33,8 @@ FormEditAccount::FormEditAccount(QWidget *parent)
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint); setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
setWindowIcon(qApp->icons()->fromTheme(QSL("application-ttrss"))); setWindowIcon(qApp->icons()->fromTheme(QSL("application-ttrss")));
m_ui->m_lblServerSideUpdateInformation->setText(tr("Leaving this option on causes that updates "
"of feeds will be probably much slower and may time-out often."));
m_ui->m_lblDescription->setText(tr("Note that at least API level %1 is required.").arg(MINIMAL_API_LEVEL)); m_ui->m_lblDescription->setText(tr("Note that at least API level %1 is required.").arg(MINIMAL_API_LEVEL));
m_ui->m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username")); m_ui->m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username"));
m_ui->m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password")); m_ui->m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password"));

View File

@ -33,7 +33,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="m_gbAuthentication"> <widget class="QGroupBox" name="m_gbAuthentication">
<property name="toolTip"> <property name="toolTip">
<string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string> <string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string>
@ -84,7 +84,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="5" column="0" colspan="2">
<widget class="QGroupBox" name="m_gbHttpAuthentication"> <widget class="QGroupBox" name="m_gbHttpAuthentication">
<property name="toolTip"> <property name="toolTip">
<string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string> <string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string>
@ -138,14 +138,14 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QPushButton" name="m_btnTestSetup"> <widget class="QPushButton" name="m_btnTestSetup">
<property name="text"> <property name="text">
<string>&amp;Test setup</string> <string>&amp;Test setup</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="LabelWithStatus" name="m_lblTestResult" native="true"> <widget class="LabelWithStatus" name="m_lblTestResult" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -163,9 +163,6 @@
<property name="text"> <property name="text">
<string>Force execution of server-side update when updating feeds from RSS Guard</string> <string>Force execution of server-side update when updating feeds from RSS Guard</string>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="2">
@ -173,6 +170,19 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="m_lblServerSideUpdateInformation">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -130,8 +130,8 @@ void TtRssServiceRoot::addNewFeed(const QString &url) {
} }
QScopedPointer<FormEditFeed> form_pointer(new FormEditFeed(this, qApp->mainForm())); QScopedPointer<FormEditFeed> form_pointer(new FormEditFeed(this, qApp->mainForm()));
form_pointer.data()->execForAdd(url);
form_pointer.data()->execForAdd(url);
qApp->feedUpdateLock()->unlock(); qApp->feedUpdateLock()->unlock();
} }
@ -169,10 +169,6 @@ QVariant TtRssServiceRoot::data(int column, int role) const {
} }
} }
QList<QAction*> TtRssServiceRoot::addItemMenu() {
return QList<QAction*>();
}
RecycleBin *TtRssServiceRoot::recycleBin() const { RecycleBin *TtRssServiceRoot::recycleBin() const {
return m_recycleBin; return m_recycleBin;
} }
@ -188,10 +184,6 @@ QList<QAction*> TtRssServiceRoot::serviceMenu() {
return m_serviceMenu; return m_serviceMenu;
} }
QList<QAction*> TtRssServiceRoot::contextMenu() {
return serviceMenu();
}
bool TtRssServiceRoot::onBeforeSetMessagesRead(RootItem *selected_item, const QList<Message> &messages, RootItem::ReadStatus read) { bool TtRssServiceRoot::onBeforeSetMessagesRead(RootItem *selected_item, const QList<Message> &messages, RootItem::ReadStatus read) {
Q_UNUSED(selected_item) Q_UNUSED(selected_item)

View File

@ -37,25 +37,16 @@ class TtRssServiceRoot : public ServiceRoot {
void start(bool freshly_activated); void start(bool freshly_activated);
void stop(); void stop();
QString code() const; QString code() const;
bool canBeEdited() const; bool canBeEdited() const;
bool canBeDeleted() const; bool canBeDeleted() const;
bool editViaGui(); bool editViaGui();
bool deleteViaGui(); bool deleteViaGui();
bool markAsReadUnread(ReadStatus status); bool markAsReadUnread(ReadStatus status);
bool supportsFeedAdding() const; bool supportsFeedAdding() const;
bool supportsCategoryAdding() const; bool supportsCategoryAdding() const;
QVariant data(int column, int role) const; QVariant data(int column, int role) const;
QList<QAction*> addItemMenu();
QList<QAction*> serviceMenu(); QList<QAction*> serviceMenu();
QList<QAction*> contextMenu();
RecycleBin *recycleBin() const; RecycleBin *recycleBin() const;
bool onBeforeSetMessagesRead(RootItem *selected_item, const QList<Message> &messages, ReadStatus read); bool onBeforeSetMessagesRead(RootItem *selected_item, const QList<Message> &messages, ReadStatus read);
@ -83,9 +74,20 @@ class TtRssServiceRoot : public ServiceRoot {
QStringList customIDsOfMessages(const QList<QPair<Message,Importance> > &changes); QStringList customIDsOfMessages(const QList<QPair<Message,Importance> > &changes);
QStringList customIDsOfMessages(const QList<Message> &messages); QStringList customIDsOfMessages(const QList<Message> &messages);
// Removes all messages/categories/feeds which are
// associated with this account.
void removeOldFeedTree(bool including_messages); void removeOldFeedTree(bool including_messages);
// Removes messages which do not belong to any
// existing feed.
//
// NOTE: This situation may happen if user deletes some feed
// from another machine and then performs sync-in on this machine.
void removeLeftOverMessages(); void removeLeftOverMessages();
void cleanAllItems(); void cleanAllItems();
// Takes new tree and adds its feeds/categories/whatever.
// Used in syncing.
void storeNewFeedTree(RootItem *root); void storeNewFeedTree(RootItem *root);
void loadFromDatabase(); void loadFromDatabase();