- Make sure items are not overwriten when drag 'n dropping items in RSS feed list

This commit is contained in:
Christophe Dumez
2009-08-24 04:01:26 +00:00
parent 8e2efc2950
commit a0923741a4
4 changed files with 19 additions and 0 deletions

View File

@@ -132,6 +132,7 @@ public:
signals:
void foldersAltered(QList<QTreeWidgetItem*> folders);
void overwriteAttempt(QString filename);
protected slots:
void updateCurrentFeed(QTreeWidgetItem* new_item) {
@@ -161,6 +162,15 @@ protected:
dest_folder = rssmanager;
}
QList<QTreeWidgetItem *> src_items = selectedItems();
// Check if there is not going to overwrite another file
foreach(QTreeWidgetItem *src_item, src_items) {
RssFile *file = getRSSItem(src_item);
if(dest_folder->hasChild(file->getID())) {
emit overwriteAttempt(file->getID());
return;
}
}
// Proceed with the move
foreach(QTreeWidgetItem *src_item, src_items) {
QTreeWidgetItem *parent_folder = src_item->parent();
if(parent_folder && !folders_altered.contains(parent_folder))