void RSSEditPopup::parseAndSave(void) { if (m_editing) { QString title = m_titleEdit->GetText(); QString desc = m_descEdit->GetText(); QString author = m_authorEdit->GetText(); QString link = m_urlEdit->GetText(); QString filename = m_thumbImage->GetFilename(); bool download; if (m_download->GetCheckState() == MythUIStateType::Full) download = true; else download = false; removeFromDB(m_urlText, VIDEO_PODCAST); if (insertInDB(new RSSSite(title, filename, VIDEO_PODCAST, desc, link, author, download, QDateTime::currentDateTime()))) emit saving(); Close(); } else { m_manager = new QNetworkAccessManager(); QUrl qurl(m_urlEdit->GetText()); m_reply = m_manager->get(QNetworkRequest(qurl)); connect(m_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotCheckRedirect(QNetworkReply*))); } }
void MythNewsConfig::toggleItem(MythUIButtonListItem *item) { QMutexLocker locker(&m_lock); if (!item ) return; NewsSiteItem *site = qVariantValue<NewsSiteItem*>(item->GetData()); if (!site) return; bool checked = (item->state() == MythUIButtonListItem::FullChecked); if (!checked) { if (insertInDB(site)) { site->inDB = true; item->setChecked(MythUIButtonListItem::FullChecked); } } else { if (removeFromDB(site)) { site->inDB = false; item->setChecked(MythUIButtonListItem::NotChecked); } } }
void RSSEditor::doDeleteSite(bool remove) { QMutexLocker locker(&m_lock); if (!remove) return; RSSSite *site = qVariantValue<RSSSite *>(m_sites->GetItemCurrent()->GetData()); if (removeFromDB(site)) listChanged(); }
void MythNewsEditor::Save(void) { { QMutexLocker locker(&m_lock); if (m_editing && !m_siteName.isEmpty()) removeFromDB(m_siteName); insertInDB(m_nameEdit->GetText(), m_urlEdit->GetText(), m_iconEdit->GetText(), "custom", (m_podcastCheck->GetCheckState() == MythUIStateType::Full)); } Close(); }
void MythNews::deleteNewsSite(void) { QMutexLocker locker(&m_lock); MythUIButtonListItem *siteUIItem = m_sitesList->GetItemCurrent(); if (siteUIItem && !siteUIItem->GetData().isNull()) { NewsSite *site = qVariantValue<NewsSite*>(siteUIItem->GetData()); if (site) { removeFromDB(site->name()); loadSites(); } } }
bool removeFromDB(RSSSite* site) { if (!site) return false; return removeFromDB(site->GetURL(), site->GetType()); }