[KPhotoAlbum] Token setting in thumbnail view

Johannes Zarl isilmendil at isilme.lupus.uberspace.de
Mon Jul 15 22:19:40 CEST 2013


Hi Robert,

I totally forgot to ask: do you have commit access to add this to the 
repository yourself?

Cheers,
  Johannes

On Saturday 06 July 2013 20:15:49 Robert Krawitz wrote:
> The following patch allows you to set/clear a token for all members of a
> stack when in thumbnail view by typing an uppercase letter (similarly
> for rating).
> 
> diff --git a/ThumbnailView/KeyboardEventHandler.cpp
> b/ThumbnailView/KeyboardEventHandler.cpp index 9c341d1..e6a7195 100644
> --- a/ThumbnailView/KeyboardEventHandler.cpp
> +++ b/ThumbnailView/KeyboardEventHandler.cpp
> @@ -34,12 +34,12 @@
> ThumbnailView::KeyboardEventHandler::KeyboardEventHandler(
> ThumbnailFactory* fac
> 
>  bool ThumbnailView::KeyboardEventHandler::keyPressEvent( QKeyEvent* event )
> {
> -    if ( event->modifiers() == Qt::NoModifier && ( event->key() >=
> Qt::Key_A && event->key() <= Qt::Key_Z ) ) { +    if ( ( event->modifiers()
> == Qt::NoModifier || event->modifiers() == Qt::ShiftModifier )  && (
> event->key() >= Qt::Key_A && event->key() <= Qt::Key_Z ) ) { QString token
> = event->text().toUpper().left(1);
>          bool mustRemoveToken = false;
>          bool hadHit          = false;
> 
> -        const DB::FileNameList selection =
> widget()->selection(NoExpandCollapsedStacks); +        const
> DB::FileNameList selection = widget()->selection( event->modifiers() ==
> Qt::NoModifier ? NoExpandCollapsedStacks : ExpandCollapsedStacks );
> Q_FOREACH( const DB::FileName& fileName, selection ) {
>              DB::ImageInfoPtr info = fileName.info();
>              if ( ! hadHit ) {
> @@ -60,11 +60,11 @@ bool ThumbnailView::KeyboardEventHandler::keyPressEvent(
> QKeyEvent* event ) return true;
>      }
> 
> -    if ( event->modifiers() == Qt::NoModifier && ( event->key() >=
> Qt::Key_0 && event->key() <= Qt::Key_5 ) ) { +    if ( ( event->modifiers()
> == Qt::NoModifier || event->modifiers() == Qt::ShiftModifier ) && (
> event->key() >= Qt::Key_0 && event->key() <= Qt::Key_5 ) ) { bool ok;
>          short rating = event->text().left(1).toShort(&ok, 10);
>          if (ok) {
> -            const DB::FileNameList selection = widget()->selection(
> NoExpandCollapsedStacks ); +            const DB::FileNameList selection =
> widget()->selection( event->modifiers() == Qt::NoModifier ?
> NoExpandCollapsedStacks : ExpandCollapsedStacks ); Q_FOREACH( const
> DB::FileName& fileName, selection ) { DB::ImageInfoPtr info =
> fileName.info();
>                  info->setRating(rating * 2);


More information about the KPhotoAlbum mailing list