Bug 145158

Summary: Wish: way to copy tags between photos
Product: [Applications] kphotoalbum Reporter: Martin Jost <ntgbkrg7t>
Component: Annotation DialogAssignee: KPhotoAlbum Bugs <kpabugs>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 2.1   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Martin Jost 2007-05-07 21:33:10 UTC
Version:           3.0.2 (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs
Compiler:          4.1.2 
OS:                Linux

To improve tagging of photos with similar contents, I would like to see:

1
A key (and/or control) in the tagging window to tell KPA: Copy the
tags of the last tagged photo to this one. 

2
A way to copy tags, by drag and drop in the main window, so I can
easily copy already present tags between photos. (Probably this should
*add* the tags of the dropped photo to the already present ones)

Background:
Sometimes I have a lot of photos here, which show e.g. "nearly" the same persons (give or take one or two). So when tagging those photos one by one, I re-enter the same names again and again.

The obvious choice is to use "tag multiple photos at once" (Ctrl-2). IHMO this poses two drawbacks:
1.
You have to select all the photos first. This usually ends up with a
bunch of photos wildly distributed within the whole set, I'm working on.
Nevertheless I miss some - this is the reason for my wish for a way to
drag-and-drop the whole set of tags attached to one photo.
2.
When you tag with Ctrl-2, no photo is shown at all in the dialog. So I
end up juggling the diashow window (to see the photo), the tagging
window (to tag it) and the main window (which when iconised  iconizes
the tagging window too)...
Comment 1 Stephan Kulow 2007-05-08 16:14:17 UTC
Jesper: you need to have a "unspecified" version for your product - or people will have problems commenting on their own bugs
Comment 2 Jan Kundrát 2007-06-10 00:32:41 UTC
SVN commit 673330 by jkt:

Allow re-using of tags from the previously tagged image in the annotation dialog

FEATURE: 145158


 M  +30 -0     AnnotationDialog/Dialog.cpp  
 M  +2 -0      AnnotationDialog/Dialog.h  
 M  +5 -0      ChangeLog  


--- branches/extragear/kde3/graphics/kphotoalbum/AnnotationDialog/Dialog.cpp #673329:673330
@@ -159,6 +159,12 @@
     _rotateRight->setIconSet( KGlobal::iconLoader()->loadIconSet( QString::fromLatin1( "rotate_cw" ), KIcon::Desktop, 22 ) );
     _rotateRight->setFixedWidth( 40 );
 
+    _copyPreviousBut = new QPushButton( top2 );
+    lay6->addWidget( _copyPreviousBut );
+    _copyPreviousBut->setIconSet( KGlobal::iconLoader()->loadIconSet( QString::fromLatin1( "legalmoves" ), KIcon::Desktop, 22 ) );
+    _copyPreviousBut->setFixedWidth( 40 );
+    connect( _copyPreviousBut, SIGNAL( clicked() ), this, SLOT( slotCopyPrevious() ) );
+    
     lay6->addStretch( 1 );
     _delBut = new QPushButton( top2 );
     _delBut->setPixmap( KGlobal::iconLoader()->loadIcon( QString::fromLatin1( "editdelete" ), KIcon::Desktop, 22 ) );
@@ -328,6 +334,24 @@
     }
 }
 
+/*
+ * Copy tags (only tags/categories, not description/label/...) from previous image to the currently showed one
+ */
+void AnnotationDialog::Dialog::slotCopyPrevious()
+{
+    if ( _setup != InputSingleImageConfigMode )
+        return;
+    if ( _current < 1 )
+        return;
+
+    // FIXME: it would be better to compute the "previous image" in a better way, but let's stick with this for now...
+    DB::ImageInfo& old_info = _editList[ _current - 1 ];
+
+    for( QPtrListIterator<ListSelect> it( _optionList ); *it; ++it ) {
+        (*it)->setSelection( old_info.itemsOfCategory( (*it)->category() ) );
+    }
+}
+
 void AnnotationDialog::Dialog::load()
 {
     DB::ImageInfo& info = _editList[ _current ];
@@ -357,6 +381,7 @@
 
     _nextBut->setEnabled( _current != (int)_origList.count()-1 );
     _prevBut->setEnabled( _current != 0 );
+    _copyPreviousBut->setEnabled( _current != 0 );
 
     _preview->setImage( info );
 
@@ -429,6 +454,7 @@
 
         _prevBut->setEnabled( false );
         _nextBut->setEnabled( false );
+        _copyPreviousBut->setEnabled( false );
     }
 
     _thumbnailShouldReload = false;
@@ -493,6 +519,7 @@
     }
 
     _delBut->setEnabled( _setup == InputSingleImageConfigMode );
+    _copyPreviousBut->setEnabled( _setup == InputSingleImageConfigMode );
 
     for( QPtrListIterator<ListSelect> it( _optionList ); *it; ++it )
         (*it)->setMode( _setup );
@@ -931,6 +958,9 @@
     new KAction( i18n("Delete"), CTRL+Key_Delete, this, SLOT( slotDeleteImage() ),
                  _actions, "annotationdialog-delete-image" );
 
+    new KAction( i18n("Copy tags from previous image"), CTRL+Key_Insert, this, SLOT( slotCopyPrevious() ),
+                 _actions, "annotationdialog-copy-previous");
+
     new KAction( i18n("Rotate Left"), 0, this, SLOT( rotateLeft() ), _actions, "annotationdialog-rotate-left" );
     new KAction( i18n("Rotate Right"), 0, this, SLOT( rotateRight() ), _actions, "annotationdialog-rotate-right" );
 
--- branches/extragear/kde3/graphics/kphotoalbum/AnnotationDialog/Dialog.h #673329:673330
@@ -80,6 +80,7 @@
     void slotDeleteImage();
     void slotResetLayout();
     void slotStartDateChanged( const DB::ImageDate& );
+    void slotCopyPrevious();
 
 protected:
     void load();
@@ -132,6 +133,7 @@
     QPushButton* _rotateLeft;
     QPushButton* _rotateRight;
     QPushButton* _delBut;
+    QPushButton* _copyPreviousBut;
     Editor* _description;
     KTimeWidget* _time;
     QPushButton* _addTime;
--- branches/extragear/kde3/graphics/kphotoalbum/ChangeLog #673329:673330
@@ -1,3 +1,8 @@
+2007-06-10  Jan Kundrat <jkt@gentoo.org>
+
+	* Allow re-using of tags from the previously tagged image in the
+	annotation dialog (first part of bug #145158)
+
 2007-05-23  Jan Kundrat <jkt@gentoo.org>
 
 	* Make "show this image" fast again.