Added "Accounts" menu and some minor TT-RSS stuff.
This commit is contained in:
parent
7d13039533
commit
7b7fe704d2
9 changed files with 84 additions and 38 deletions
|
@ -197,34 +197,6 @@ void FormMain::updateAddItemMenu() {
|
||||||
|
|
||||||
m_ui->m_menuAddItem->addMenu(root_menu);
|
m_ui->m_menuAddItem->addMenu(root_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ui->m_menuAddItem->actions().size() > 0) {
|
|
||||||
m_ui->m_menuAddItem->addSeparator();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ui->m_menuAddItem->addAction(m_ui->m_actionServiceAdd);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* foreach (ServiceRoot *activated_root, tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->serviceRoots()) {
|
|
||||||
QMenu *root_menu = new QMenu(activated_root->title(), m_ui->m_menuServices);
|
|
||||||
root_menu->setIcon(activated_root->icon());
|
|
||||||
root_menu->setToolTip(activated_root->description());
|
|
||||||
|
|
||||||
QList<QAction*> root_actions = activated_root->serviceMenu();
|
|
||||||
|
|
||||||
if (root_actions.isEmpty()) {
|
|
||||||
QAction *no_action = new QAction(qApp->icons()->fromTheme(QSL("dialog-error")),
|
|
||||||
tr("No possible actions"),
|
|
||||||
m_ui->m_menuServices);
|
|
||||||
no_action->setEnabled(false);
|
|
||||||
root_menu->addAction(no_action);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
root_menu->addActions(root_actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ui->m_menuServices->addMenu(root_menu);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormMain::updateRecycleBinMenu() {
|
void FormMain::updateRecycleBinMenu() {
|
||||||
|
@ -270,6 +242,39 @@ void FormMain::updateRecycleBinMenu() {
|
||||||
m_ui->m_menuRecycleBin->addAction(m_ui->m_actionEmptyAllRecycleBins);
|
m_ui->m_menuRecycleBin->addAction(m_ui->m_actionEmptyAllRecycleBins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormMain::updateAccountsMenu() {
|
||||||
|
m_ui->m_menuAccounts->clear();
|
||||||
|
|
||||||
|
foreach (ServiceRoot *activated_root, tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->serviceRoots()) {
|
||||||
|
QMenu *root_menu = new QMenu(activated_root->title(), m_ui->m_menuAccounts);
|
||||||
|
root_menu->setIcon(activated_root->icon());
|
||||||
|
root_menu->setToolTip(activated_root->description());
|
||||||
|
|
||||||
|
QList<QAction*> root_actions = activated_root->serviceMenu();
|
||||||
|
|
||||||
|
if (root_actions.isEmpty()) {
|
||||||
|
QAction *no_action = new QAction(qApp->icons()->fromTheme(QSL("dialog-error")),
|
||||||
|
tr("No possible actions"),
|
||||||
|
m_ui->m_menuAccounts);
|
||||||
|
no_action->setEnabled(false);
|
||||||
|
root_menu->addAction(no_action);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
root_menu->addActions(root_actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui->m_menuAccounts->addMenu(root_menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ui->m_menuAccounts->actions().size() > 0) {
|
||||||
|
m_ui->m_menuAccounts->addSeparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui->m_menuAccounts->addAction(m_ui->m_actionServiceAdd);
|
||||||
|
m_ui->m_menuAccounts->addAction(m_ui->m_actionServiceEdit);
|
||||||
|
m_ui->m_menuAccounts->addAction(m_ui->m_actionServiceDelete);
|
||||||
|
}
|
||||||
|
|
||||||
void FormMain::switchVisibility(bool force_hide) {
|
void FormMain::switchVisibility(bool force_hide) {
|
||||||
if (force_hide || isVisible()) {
|
if (force_hide || isVisible()) {
|
||||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||||
|
@ -368,6 +373,8 @@ void FormMain::setupIcons() {
|
||||||
m_ui->m_actionRestoreAllRecycleBins->setIcon(icon_theme_factory->fromTheme(QSL("recycle-bin-restore-all")));
|
m_ui->m_actionRestoreAllRecycleBins->setIcon(icon_theme_factory->fromTheme(QSL("recycle-bin-restore-all")));
|
||||||
m_ui->m_actionEmptyAllRecycleBins->setIcon(icon_theme_factory->fromTheme(QSL("recycle-bin-empty")));
|
m_ui->m_actionEmptyAllRecycleBins->setIcon(icon_theme_factory->fromTheme(QSL("recycle-bin-empty")));
|
||||||
m_ui->m_actionServiceAdd->setIcon(icon_theme_factory->fromTheme(QSL("item-new")));
|
m_ui->m_actionServiceAdd->setIcon(icon_theme_factory->fromTheme(QSL("item-new")));
|
||||||
|
m_ui->m_actionServiceEdit->setIcon(icon_theme_factory->fromTheme(QSL("item-edit")));
|
||||||
|
m_ui->m_actionServiceDelete->setIcon(icon_theme_factory->fromTheme(QSL("item-remove")));
|
||||||
|
|
||||||
// Setup icons for underlying components: opened web browsers...
|
// Setup icons for underlying components: opened web browsers...
|
||||||
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
|
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
|
||||||
|
@ -442,6 +449,10 @@ void FormMain::createConnections() {
|
||||||
|
|
||||||
connect(m_ui->m_menuAddItem, SIGNAL(aboutToShow()), this, SLOT(updateAddItemMenu()));
|
connect(m_ui->m_menuAddItem, SIGNAL(aboutToShow()), this, SLOT(updateAddItemMenu()));
|
||||||
connect(m_ui->m_menuRecycleBin, SIGNAL(aboutToShow()), this, SLOT(updateRecycleBinMenu()));
|
connect(m_ui->m_menuRecycleBin, SIGNAL(aboutToShow()), this, SLOT(updateRecycleBinMenu()));
|
||||||
|
connect(m_ui->m_menuAccounts, SIGNAL(aboutToShow()), this, SLOT(updateAccountsMenu()));
|
||||||
|
|
||||||
|
connect(m_ui->m_actionServiceDelete, SIGNAL(triggered()), m_ui->m_actionDeleteSelectedItem, SIGNAL(triggered()));
|
||||||
|
connect(m_ui->m_actionServiceEdit, SIGNAL(triggered()), m_ui->m_actionEditSelectedItem, SIGNAL(triggered()));
|
||||||
|
|
||||||
// Menu "File" connections.
|
// Menu "File" connections.
|
||||||
connect(m_ui->m_actionBackupDatabaseSettings, SIGNAL(triggered()), this, SLOT(backupDatabaseSettings()));
|
connect(m_ui->m_actionBackupDatabaseSettings, SIGNAL(triggered()), this, SLOT(backupDatabaseSettings()));
|
||||||
|
|
|
@ -76,6 +76,7 @@ class FormMain : public QMainWindow {
|
||||||
private slots:
|
private slots:
|
||||||
void updateAddItemMenu();
|
void updateAddItemMenu();
|
||||||
void updateRecycleBinMenu();
|
void updateRecycleBinMenu();
|
||||||
|
void updateAccountsMenu();
|
||||||
|
|
||||||
// Loads web browser menu if user selects to change tabs.
|
// Loads web browser menu if user selects to change tabs.
|
||||||
void loadWebBrowserMenu(int index);
|
void loadWebBrowserMenu(int index);
|
||||||
|
|
|
@ -126,13 +126,12 @@
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="m_menuFeeds">
|
<widget class="QMenu" name="m_menuFeeds">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Feeds && categories && accounts</string>
|
<string>Feeds && categories</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="m_menuAddItem">
|
<widget class="QMenu" name="m_menuAddItem">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Add &new item</string>
|
<string>Add &new item</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="m_actionServiceAdd"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="m_actionUpdateAllItems"/>
|
<addaction name="m_actionUpdateAllItems"/>
|
||||||
<addaction name="m_actionUpdateSelectedItems"/>
|
<addaction name="m_actionUpdateSelectedItems"/>
|
||||||
|
@ -181,8 +180,17 @@
|
||||||
<addaction name="m_actionRestoreAllRecycleBins"/>
|
<addaction name="m_actionRestoreAllRecycleBins"/>
|
||||||
<addaction name="m_actionEmptyAllRecycleBins"/>
|
<addaction name="m_actionEmptyAllRecycleBins"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="m_menuAccounts">
|
||||||
|
<property name="title">
|
||||||
|
<string>&Accounts</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="m_actionServiceAdd"/>
|
||||||
|
<addaction name="m_actionServiceEdit"/>
|
||||||
|
<addaction name="m_actionServiceDelete"/>
|
||||||
|
</widget>
|
||||||
<addaction name="m_menuFile"/>
|
<addaction name="m_menuFile"/>
|
||||||
<addaction name="m_menuView"/>
|
<addaction name="m_menuView"/>
|
||||||
|
<addaction name="m_menuAccounts"/>
|
||||||
<addaction name="m_menuFeeds"/>
|
<addaction name="m_menuFeeds"/>
|
||||||
<addaction name="m_menuMessages"/>
|
<addaction name="m_menuMessages"/>
|
||||||
<addaction name="m_menuRecycleBin"/>
|
<addaction name="m_menuRecycleBin"/>
|
||||||
|
@ -705,7 +713,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionServiceAdd">
|
<action name="m_actionServiceAdd">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Add new service account</string>
|
<string>&Add new account</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
|
@ -757,6 +765,22 @@
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="m_actionServiceEdit">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Edit selected account</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="m_actionServiceDelete">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Delete selected account</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -211,7 +211,12 @@ void FeedMessageViewer::updateFeedButtonsAvailability() {
|
||||||
form_main->m_ui->m_actionUpdateSelectedItems->setEnabled(!critical_action_running && (feed_selected || category_selected || service_selected));
|
form_main->m_ui->m_actionUpdateSelectedItems->setEnabled(!critical_action_running && (feed_selected || category_selected || service_selected));
|
||||||
form_main->m_ui->m_actionViewSelectedItemsNewspaperMode->setEnabled(anything_selected);
|
form_main->m_ui->m_actionViewSelectedItemsNewspaperMode->setEnabled(anything_selected);
|
||||||
form_main->m_ui->m_actionExpandCollapseItem->setEnabled(anything_selected);
|
form_main->m_ui->m_actionExpandCollapseItem->setEnabled(anything_selected);
|
||||||
|
|
||||||
|
form_main->m_ui->m_actionServiceDelete->setEnabled(service_selected);
|
||||||
|
form_main->m_ui->m_actionServiceEdit->setEnabled(service_selected);
|
||||||
|
|
||||||
form_main->m_ui->m_menuAddItem->setEnabled(!critical_action_running);
|
form_main->m_ui->m_menuAddItem->setEnabled(!critical_action_running);
|
||||||
|
form_main->m_ui->m_menuAccounts->setEnabled(!critical_action_running);
|
||||||
form_main->m_ui->m_menuRecycleBin->setEnabled(!critical_action_running);
|
form_main->m_ui->m_menuRecycleBin->setEnabled(!critical_action_running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ QVariant Feed::data(int column, int role) const {
|
||||||
case NewMessages:
|
case NewMessages:
|
||||||
return QColor(Qt::blue);
|
return QColor(Qt::blue);
|
||||||
|
|
||||||
case NetworkError:
|
case Error:
|
||||||
return QColor(Qt::red);
|
return QColor(Qt::red);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Feed : public RootItem {
|
||||||
enum Status {
|
enum Status {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
NewMessages = 1,
|
NewMessages = 1,
|
||||||
NetworkError = 2,
|
Error = 2,
|
||||||
ParsingError = 3,
|
ParsingError = 3,
|
||||||
OtherError = 4
|
OtherError = 4
|
||||||
};
|
};
|
||||||
|
|
|
@ -447,7 +447,7 @@ int StandardFeed::update() {
|
||||||
|
|
||||||
if (m_networkError != QNetworkReply::NoError) {
|
if (m_networkError != QNetworkReply::NoError) {
|
||||||
qWarning("Error during fetching of new messages for feed '%s' (id %d).", qPrintable(url()), id());
|
qWarning("Error during fetching of new messages for feed '%s' (id %d).", qPrintable(url()), id());
|
||||||
setStatus(NetworkError);
|
setStatus(Error);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (status() != NewMessages) {
|
else if (status() != NewMessages) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ int TtRssFeed::update() {
|
||||||
true, true, false, error);
|
true, true, false, error);
|
||||||
|
|
||||||
if (error != QNetworkReply::NoError) {
|
if (error != QNetworkReply::NoError) {
|
||||||
setStatus(Feed::NetworkError);
|
setStatus(Feed::Error);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -273,9 +273,6 @@ int TtRssFeed::updateMessages(const QList<Message> &messages) {
|
||||||
if (query_insert.exec() && query_insert.numRowsAffected() == 1) {
|
if (query_insert.exec() && query_insert.numRowsAffected() == 1) {
|
||||||
updated_messages++;
|
updated_messages++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
QString str = query_insert.lastError().text();
|
|
||||||
}
|
|
||||||
|
|
||||||
query_insert.finish();
|
query_insert.finish();
|
||||||
|
|
||||||
|
|
|
@ -531,6 +531,11 @@ void TtRssServiceRoot::completelyRemoveAllData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TtRssServiceRoot::syncIn() {
|
void TtRssServiceRoot::syncIn() {
|
||||||
|
QIcon original_icon = icon();
|
||||||
|
|
||||||
|
setIcon(qApp->icons()->fromTheme(QSL("item-sync")));
|
||||||
|
itemChanged(QList<RootItem*>() << this);
|
||||||
|
|
||||||
QNetworkReply::NetworkError err;
|
QNetworkReply::NetworkError err;
|
||||||
TtRssGetFeedsCategoriesResponse feed_cats_response = m_network->getFeedsCategories(err);
|
TtRssGetFeedsCategoriesResponse feed_cats_response = m_network->getFeedsCategories(err);
|
||||||
|
|
||||||
|
@ -561,6 +566,9 @@ void TtRssServiceRoot::syncIn() {
|
||||||
requestReloadMessageList(true);
|
requestReloadMessageList(true);
|
||||||
requestItemExpand(all_items, true);
|
requestItemExpand(all_items, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setIcon(original_icon);
|
||||||
|
itemChanged(QList<RootItem*>() << this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList TtRssServiceRoot::customIDsOfMessages(const QList<QPair<Message,RootItem::Importance> > &changes) {
|
QStringList TtRssServiceRoot::customIDsOfMessages(const QList<QPair<Message,RootItem::Importance> > &changes) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue