Esempio n. 1
0
bool TtRssRecycleBin::markAsReadUnread(RootItem::ReadStatus status) {
  QStringList ids = serviceRoot()->customIDSOfMessagesForItem(this);
  TtRssUpdateArticleResponse response = serviceRoot()->network()->updateArticles(ids, UpdateArticle::Unread,
                                                                                 status == RootItem::Unread ?
                                                                                   UpdateArticle::SetToTrue :
                                                                                   UpdateArticle::SetToFalse);

  if (serviceRoot()->network()->lastError() != QNetworkReply::NoError || response.updateStatus() != STATUS_OK) {
    return false;
  }
  else {
    return RecycleBin::markAsReadUnread(status);
  }
}
Esempio n. 2
0
void StandardFeed::fetchMetadataForItself() {
  QPair<StandardFeed*, QNetworkReply::NetworkError> metadata = guessFeed(url(), username(), password());

  if (metadata.first != nullptr && metadata.second == QNetworkReply::NoError) {
    // Some properties are not updated when new metadata are fetched.
    metadata.first->setParent(parent());
    metadata.first->setUrl(url());
    metadata.first->setPasswordProtected(passwordProtected());
    metadata.first->setUsername(username());
    metadata.first->setPassword(password());
    metadata.first->setAutoUpdateType(autoUpdateType());
    metadata.first->setAutoUpdateInitialInterval(autoUpdateInitialInterval());
    editItself(metadata.first);
    delete metadata.first;

    // Notify the model about fact, that it needs to reload new information about
    // this item, particularly the icon.
    serviceRoot()->itemChanged(QList<RootItem*>() << this);
  }
  else {
    qApp->showGuiMessage(tr("Metadata not fetched"),
                         tr("Metadata was not fetched because: %1.").arg(NetworkFactory::networkErrorText(metadata.second)),
                         QSystemTrayIcon::Critical);
  }
}
Esempio n. 3
0
bool StandardCategory::deleteViaGui() {
  if (removeItself()) {
    serviceRoot()->requestItemRemoval(this);
    return true;
  }
  else {
    return false;
  }
}
Esempio n. 4
0
bool StandardCategory::performDragDropChange(RootItem *target_item) {
  StandardCategory *category_new = new StandardCategory(*this);
  category_new->clearChildren();
  category_new->setParent(target_item);

  if (editItself(category_new)) {
    serviceRoot()->requestItemReassignment(this, target_item);
    delete category_new;
    return true;
  }
  else {
    delete category_new;
    return false;
  }
}
Esempio n. 5
0
bool StandardFeed::performDragDropChange(RootItem* target_item) {
  StandardFeed* feed_new = new StandardFeed(*this);

  feed_new->setParent(target_item);

  if (editItself(feed_new)) {
    serviceRoot()->requestItemReassignment(this, target_item);
    delete feed_new;
    return true;
  }
  else {
    delete feed_new;
    return false;
  }
}
Esempio n. 6
0
bool StandardCategory::editViaGui() {
  QScopedPointer<FormStandardCategoryDetails> form_pointer(new FormStandardCategoryDetails(serviceRoot(), qApp->mainForm()));

  form_pointer.data()->exec(this, nullptr);
  return false;
}
Esempio n. 7
0
bool StandardCategory::cleanMessages(bool clean_read_only) {
  return serviceRoot()->cleanFeeds(getSubTreeFeeds(), clean_read_only);
}
Esempio n. 8
0
bool StandardCategory::markAsReadUnread(ReadStatus status) {
  return serviceRoot()->markFeedsReadUnread(getSubTreeFeeds(), status);
}
Esempio n. 9
0
bool StandardFeed::editViaGui() {
  QScopedPointer<FormStandardFeedDetails> form_pointer(new FormStandardFeedDetails(serviceRoot(), qApp->mainFormWidget()));
  form_pointer.data()->addEditFeed(this, nullptr);
  return false;
}
Esempio n. 10
0
QList<QAction*> StandardFeed::contextMenu() {
  return serviceRoot()->getContextMenuForFeed(this);
}