1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Fix possible crash with Qt 4.4

This commit is contained in:
Christophe Dumez 2010-03-07 20:27:39 +00:00
parent 537c73d548
commit c287879e55
2 changed files with 7 additions and 5 deletions

View File

@ -28,15 +28,16 @@ public:
setColumnCount(1); setColumnCount(1);
QTreeWidgetItem *___qtreewidgetitem = headerItem(); QTreeWidgetItem *___qtreewidgetitem = headerItem();
___qtreewidgetitem->setText(0, QApplication::translate("RSS", "RSS feeds", 0, QApplication::UnicodeUTF8)); ___qtreewidgetitem->setText(0, QApplication::translate("RSS", "RSS feeds", 0, QApplication::UnicodeUTF8));
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentFeed(QTreeWidgetItem*)));
unread_item = new QTreeWidgetItem(this); unread_item = new QTreeWidgetItem(this);
unread_item->setText(0, tr("Unread") + QString::fromUtf8(" (") + QString::number(rssmanager->getNbUnRead(), 10)+ QString(")")); unread_item->setText(0, tr("Unread") + QString::fromUtf8(" (") + QString::number(rssmanager->getNbUnRead(), 10)+ QString(")"));
unread_item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/oxygen/mail-folder-inbox.png"))); unread_item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/oxygen/mail-folder-inbox.png")));
itemAdded(unread_item, rssmanager); itemAdded(unread_item, rssmanager);
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentFeed(QTreeWidgetItem*)));
setCurrentItem(unread_item); setCurrentItem(unread_item);
} }
~FeedList() { ~FeedList() {
disconnect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentFeed(QTreeWidgetItem*)));
delete unread_item; delete unread_item;
} }
@ -121,19 +122,19 @@ public:
} }
RssFile* getRSSItem(QTreeWidgetItem *item) const { RssFile* getRSSItem(QTreeWidgetItem *item) const {
return mapping[item]; return mapping.value(item, 0);
} }
RssFile::FileType getItemType(QTreeWidgetItem *item) const { RssFile::FileType getItemType(QTreeWidgetItem *item) const {
return mapping[item]->getType(); return mapping.value(item)->getType();
} }
QString getItemID(QTreeWidgetItem *item) const { QString getItemID(QTreeWidgetItem *item) const {
return mapping[item]->getID(); return mapping.value(item)->getID();
} }
QTreeWidgetItem* getTreeItemFromUrl(QString url) const{ QTreeWidgetItem* getTreeItemFromUrl(QString url) const{
return feeds_items[url]; return feeds_items.value(url, 0);
} }
RssStream* getRSSItemFromUrl(QString url) const { RssStream* getRSSItemFromUrl(QString url) const {

View File

@ -427,6 +427,7 @@ void RSSImp::refreshNewsList(QTreeWidgetItem* item) {
} }
RssFile *rss_item = listStreams->getRSSItem(item); RssFile *rss_item = listStreams->getRSSItem(item);
if(!rss_item) return;
qDebug("Getting the list of news"); qDebug("Getting the list of news");
QList<RssItem*> news; QList<RssItem*> news;