void BookmarksManager::load() { m_bookmarks.clear(); m_identifier = 0; QFile file(SettingsManager::getPath() + QLatin1String("/bookmarks.xbel")); if (!file.open(QFile::ReadOnly | QFile::Text)) { return; } QXmlStreamReader reader(file.readAll()); if (reader.readNextStartElement() && reader.name() == QLatin1String("xbel") && reader.attributes().value(QLatin1String("version")).toString() == QLatin1String("1.0")) { while (reader.readNextStartElement()) { if (reader.name() == QLatin1String("folder") || reader.name() == QLatin1String("bookmark") || reader.name() == QLatin1String("separator")) { m_bookmarks.append(readBookmark(&reader, 0)); } else { reader.skipCurrentElement(); } } } updateUrls(); emit folderModified(0); }
bool BookmarksManager::deleteBookmark(BookmarkInformation *bookmark, bool notify) { if (!bookmark || !m_allBookmarks.contains(bookmark)) { return false; } const int folder = bookmark->parent; for (int i = 0; i < bookmark->children.count(); ++i) { deleteBookmark(bookmark->children.at(i), false); } m_bookmarks.removeAll(bookmark); m_allBookmarks.removeAll(bookmark); m_pointers[folder]->children.removeAll(bookmark); if (bookmark->type == FolderBookmark) { m_pointers.remove(bookmark->identifier); } delete bookmark; if (notify) { save(); updateUrls(); emit m_instance->folderModified(folder); } return true; }
void PageApi::setLastPage(Page *page) { m_lastPage = page->page(); m_lastPageMaxId = page->maxId(); m_lastPageMinId = page->minId(); if (!page->nextPage().isEmpty()) { m_url = page->nextPage(); } else { /*fallback(false);*/ } updateUrls(); }
bool BookmarksManager::updateBookmark(BookmarkInformation *bookmark) { if (bookmark && m_allBookmarks.contains(bookmark)) { updateUrls(); emit m_instance->folderModified(bookmark->parent); return true; } return false; }
PageApi::PageApi(Page *parentPage, Profile *profile, Site *site, Api *api, const QStringList &tags, int page, int limit, const QStringList &postFiltering, bool smart, QObject *parent, int pool, int lastPage, qulonglong lastPageMinId, qulonglong lastPageMaxId) : QObject(parent), m_parentPage(parentPage), m_profile(profile), m_site(site), m_api(api), m_search(tags), m_postFiltering(postFiltering), m_errors(QStringList()), m_imagesPerPage(limit), m_lastPage(lastPage), m_lastPageMinId(lastPageMinId), m_lastPageMaxId(lastPageMaxId), m_smart(smart), m_reply(nullptr), m_replyTags(nullptr) { m_imagesCount = -1; m_pagesCount = -1; m_imagesCountSafe = false; m_pagesCountSafe = false; m_search = tags; m_page = page; m_pool = pool; m_format = m_api->getName(); updateUrls(); }