Browse Source

- RSS feed parent was not updated after being moved to another folder

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
725700420c
  1. 4
      src/rss.cpp
  2. 9
      src/rss.h

4
src/rss.cpp

@ -317,6 +317,8 @@ void RssFolder::addFile(RssFile * item) {
(*this)[((RssFolder*)item)->getName()] = item; (*this)[((RssFolder*)item)->getName()] = item;
qDebug("Added folder %s to folder ./%s", ((RssFolder*)item)->getName().toLocal8Bit().data(), name.toLocal8Bit().data()); qDebug("Added folder %s to folder ./%s", ((RssFolder*)item)->getName().toLocal8Bit().data(), name.toLocal8Bit().data());
} }
// Update parent
item->setParent(this);
} }
/** RssManager **/ /** RssManager **/
@ -371,7 +373,9 @@ void RssManager::moveFile(QStringList old_path, QStringList new_path) {
QString new_name = new_path.takeLast(); QString new_name = new_path.takeLast();
RssFolder* dest_folder = (RssFolder*)getFile(new_path); RssFolder* dest_folder = (RssFolder*)getFile(new_path);
if(dest_folder != src_folder) { if(dest_folder != src_folder) {
// Copy to new Folder
dest_folder->addFile(item); dest_folder->addFile(item);
// Remove reference in old folder
src_folder->removeFileRef(item); src_folder->removeFileRef(item);
} else { } else {
qDebug("Nothing to move, same destination folder"); qDebug("Nothing to move, same destination folder");

9
src/rss.h

@ -91,7 +91,8 @@ public:
virtual QString getName() const = 0; virtual QString getName() const = 0;
virtual void rename(QStringList path, QString new_name) = 0; virtual void rename(QStringList path, QString new_name) = 0;
virtual void markAllAsRead() = 0; virtual void markAllAsRead() = 0;
virtual RssFolder* getParent() = 0; virtual RssFolder* getParent() const = 0;
virtual void setParent(RssFolder*) = 0;
}; };
// Item of a rss stream, single information // Item of a rss stream, single information
@ -389,7 +390,8 @@ public slots:
public: public:
RssStream(RssFolder* parent, RssManager *rssmanager, bittorrent *BTSession, QString _url); RssStream(RssFolder* parent, RssManager *rssmanager, bittorrent *BTSession, QString _url);
~RssStream(); ~RssStream();
RssFolder* getParent() { return parent; } RssFolder* getParent() const { return parent; }
void setParent(RssFolder* _parent) { parent = _parent; }
FileType getType() const; FileType getType() const;
void refresh(); void refresh();
QStringList getPath() const; QStringList getPath() const;
@ -436,7 +438,8 @@ private:
public: public:
RssFolder(RssFolder *parent, RssManager *rssmanager, bittorrent *BTSession, QString name); RssFolder(RssFolder *parent, RssManager *rssmanager, bittorrent *BTSession, QString name);
~RssFolder(); ~RssFolder();
RssFolder* getParent() { return parent; } RssFolder* getParent() const { return parent; }
void setParent(RssFolder* _parent) { parent = _parent; }
unsigned int getNbUnRead() const; unsigned int getNbUnRead() const;
FileType getType() const; FileType getType() const;
RssStream* addStream(QStringList full_path); RssStream* addStream(QStringList full_path);

Loading…
Cancel
Save