[Digikam-devel] [Bug 115153] digikam assigns tags not only to selected images with drag and drop
Gilles Caulier
caulier.gilles at kdemail.net
Thu Dec 21 14:41:53 GMT 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=115153
caulier.gilles kdemail net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From caulier.gilles kdemail net 2006-12-21 15:41 -------
SVN commit 615438 by cgilles:
digikam from trunk : fix drag and drop behaviours between tags view and album icon view. All pop-up menu will ask you if you want to assign tags to :
- All album items.
- dropped item only.
If album have items selected, 2 options are also added:
- Selected Items only .
- Selected and dropped items only (if dropped item is not in selection).
BUG: 115153
M +149 -37 albumiconview.cpp
--- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #615437:615438
@ -134,30 +134,30 @
toolTip = 0;
}
- QString albumTitle;
- QString albumDate;
- QString albumComments;
+ QString albumTitle;
+ QString albumDate;
+ QString albumComments;
- QRect itemRect;
- QRect itemRatingRect;
- QRect itemDateRect;
- QRect itemModDateRect;
- QRect itemPixmapRect;
- QRect itemNameRect;
- QRect itemCommentsRect;
- QRect itemResolutionRect;
- QRect itemSizeRect;
- QRect itemTagRect;
- QRect bannerRect;
+ QRect itemRect;
+ QRect itemRatingRect;
+ QRect itemDateRect;
+ QRect itemModDateRect;
+ QRect itemPixmapRect;
+ QRect itemNameRect;
+ QRect itemCommentsRect;
+ QRect itemResolutionRect;
+ QRect itemSizeRect;
+ QRect itemTagRect;
+ QRect bannerRect;
- QPixmap itemRegPixmap;
- QPixmap itemSelPixmap;
- QPixmap bannerPixmap;
- QPixmap ratingPixmap;
+ QPixmap itemRegPixmap;
+ QPixmap itemSelPixmap;
+ QPixmap bannerPixmap;
+ QPixmap ratingPixmap;
- QFont fnReg;
- QFont fnCom;
- QFont fnXtra;
+ QFont fnReg;
+ QFont fnCom;
+ QFont fnXtra;
QDict<AlbumIconItem> itemDict;
@ -382,7 +382,7 @
if (!item->album())
{
DWarning() << "No album for item: " << item->name()
- << ", albumID: " << item->albumID() << endl;
+ << ", albumID: " << item->albumID() << endl;
continue;
}
@ -486,8 +486,7 @
// --------------------------------------------------------
- KMimeType::Ptr mimePtr = KMimeType::findByURL(iconItem->imageInfo()->kurl(),
- 0, true, true);
+ KMimeType::Ptr mimePtr = KMimeType::findByURL(iconItem->imageInfo()->kurl(), 0, true, true);
QValueVector<KService::Ptr> serviceVector;
KTrader::OfferList offers = KTrader::self()->query(mimePtr->name(), "Type == 'Application'");
@ -1150,8 +1149,21 @
if (talbum)
{
QPopupMenu popMenu(this);
- popMenu.insertItem(i18n("&Assign Tag '%1' to Selected Images")
- .arg(talbum->prettyURL()), 10 );
+
+ bool itemsSelected = false;
+ for (IconItem *it = firstItem(); it; it = it->nextItem())
+ if (it->isSelected())
+ itemsSelected = true;
+
+ if (itemsSelected)
+ {
+ popMenu.insertItem(i18n("&Assign '%1' to Selected Items").arg(talbum->url()), 10);
+ popMenu.insertItem(i18n("&Assign '%1' to Selected/Dropped Items").arg(talbum->url()), 11);
+ popMenu.insertSeparator(-1);
+ }
+
+ popMenu.insertItem(i18n("&Assign '%1' to All Items").arg(talbum->url()), 12);
+ popMenu.insertItem(i18n("&Assign '%1' to Dropped Item").arg(talbum->url()), 13);
popMenu.insertSeparator(-1);
popMenu.insertItem( SmallIcon("cancel"), i18n("C&ancel") );
@ -1159,14 +1171,23 @
int id = popMenu.exec(QCursor::pos());
switch(id)
{
- case 10:
+ case 10: // Selected Items
{
- AlbumIconItem *albumItem = findItem(event->pos());
- if (albumItem)
+ for (IconItem *it = firstItem(); it; it = it->nextItem())
{
- albumItem->imageInfo()->setTag(tagID);
+ if (it->isSelected())
+ {
+ AlbumIconItem *albumItem = static_cast<AlbumIconItem *>(it);
+ albumItem->imageInfo()->setTag(tagID);
+ }
}
+ d->imageLister->refresh();
+ updateContents();
+ break;
+ }
+ case 11: // Selected and Dropped Items
+ {
for (IconItem *it = firstItem(); it; it = it->nextItem())
{
if (it->isSelected())
@ -1175,11 +1196,37 @
albumItem->imageInfo()->setTag(tagID);
}
}
+
+ AlbumIconItem *albumItem = findItem(event->pos());
+ if (albumItem)
+ albumItem->imageInfo()->setTag(tagID);
d->imageLister->refresh();
updateContents();
break;
}
+ case 12: // All Items
+ {
+ for (IconItem *it = firstItem(); it; it = it->nextItem())
+ {
+ AlbumIconItem *albumItem = static_cast<AlbumIconItem *>(it);
+ albumItem->imageInfo()->setTag(tagID);
+ }
+
+ d->imageLister->refresh();
+ updateContents();
+ break;
+ }
+ case 13: // Dropped Item only.
+ {
+ AlbumIconItem *albumItem = findItem(event->pos());
+ if (albumItem)
+ albumItem->imageInfo()->setTag(tagID);
+
+ d->imageLister->refresh();
+ updateContents();
+ break;
+ }
default:
break;
}
@ -1193,7 +1240,21 @
ds >> tagIDs;
QPopupMenu popMenu(this);
- popMenu.insertItem(i18n("&Assign Tags to Selected Images"), 10);
+
+ bool itemsSelected = false;
+ for (IconItem *it = firstItem(); it; it = it->nextItem())
+ if (it->isSelected())
+ itemsSelected = true;
+
+ if (itemsSelected)
+ {
+ popMenu.insertItem(i18n("&Assign Tags to Selected Items"), 10);
+ popMenu.insertItem(i18n("&Assign Tags to Selected/Dropped Items"), 11);
+ popMenu.insertSeparator(-1);
+ }
+
+ popMenu.insertItem(i18n("&Assign Tags to All Items"), 12);
+ popMenu.insertItem(i18n("&Assign Tags to Dropped Item"), 13);
popMenu.insertSeparator(-1);
popMenu.insertItem( SmallIcon("cancel"), i18n("C&ancel") );
@ -1201,18 +1262,27 @
int id = popMenu.exec(QCursor::pos());
switch(id)
{
- case 10:
+ case 10: // Selected Items
{
- AlbumIconItem *albumItem = findItem(event->pos());
- if (albumItem)
+ for (IconItem *it = firstItem(); it; it = it->nextItem())
{
- for (QValueList<int>::iterator it = tagIDs.begin();
- it != tagIDs.end(); ++it)
+ if (it->isSelected())
{
- albumItem->imageInfo()->setTag(*it);
+ AlbumIconItem *albumItem = static_cast<AlbumIconItem*>(it);
+ for (QValueList<int>::iterator it = tagIDs.begin();
+ it != tagIDs.end(); ++it)
+ {
+ albumItem->imageInfo()->setTag(*it);
+ }
}
}
+ d->imageLister->refresh();
+ updateContents();
+ break;
+ }
+ case 11: // Selected and Dropped Items
+ {
for (IconItem *it = firstItem(); it; it = it->nextItem())
{
if (it->isSelected())
@ -1225,11 +1295,53 @
}
}
}
+
+ AlbumIconItem *albumItem = findItem(event->pos());
+ if (albumItem)
+ {
+ for (QValueList<int>::iterator it = tagIDs.begin();
+ it != tagIDs.end(); ++it)
+ {
+ albumItem->imageInfo()->setTag(*it);
+ }
+ }
d->imageLister->refresh();
updateContents();
break;
}
+ case 12: // All Items
+ {
+ for (IconItem *it = firstItem(); it; it = it->nextItem())
+ {
+ AlbumIconItem *albumItem = static_cast<AlbumIconItem*>(it);
+ for (QValueList<int>::iterator it = tagIDs.begin();
+ it != tagIDs.end(); ++it)
+ {
+ albumItem->imageInfo()->setTag(*it);
+ }
+ }
+
+ d->imageLister->refresh();
+ updateContents();
+ break;
+ }
+ case 13: // Dropped item only.
+ {
+ AlbumIconItem *albumItem = findItem(event->pos());
+ if (albumItem)
+ {
+ for (QValueList<int>::iterator it = tagIDs.begin();
+ it != tagIDs.end(); ++it)
+ {
+ albumItem->imageInfo()->setTag(*it);
+ }
+ }
+
+ d->imageLister->refresh();
+ updateContents();
+ break;
+ }
default:
break;
}
More information about the Digikam-devel
mailing list