Commit ef798948 authored by Marcel Wiesweg's avatar Marcel Wiesweg
Browse files

There was a small bug in handling the custom action. Use a standard signal/userdata pattern instead

to retrieve the select toggle auto mode.

BUG: 303685
parent 0bb16af6
......@@ -26,4 +26,5 @@ BUGFIXES FROM KDE BUGZILLA (alias B.K.O | http://bugs.kde.org):
017 ==> 303242 - File type should not create distinct results in fuzzy duplicate search.
018 ==> 303419 - No images show.
019 ==> 303994 - Many face tag comboboxes and may tags, will have an impact on performance [patch].
020 ==>
020 ==> 303685 - cannot set "toggle auto" back to "none" in tags filter.
021 ==>
......@@ -92,6 +92,14 @@ TagCheckView::TagCheckView(QWidget* parent, TagModel* tagModel)
d->toggleParentsAction = d->toggleAutoAction->addAction(i18nc("toggle parent tag", "Parents"));
d->toggleBothAction = d->toggleAutoAction->addAction(i18nc("toggle child and parent tags", "Both"));
d->toggleNoneAction->setData(NoToggleAuto);
d->toggleChildrenAction->setData(Children);
d->toggleParentsAction->setData(Parents);
d->toggleBothAction->setData(ChildrenAndParents);
connect(d->toggleAutoAction, SIGNAL(triggered(QAction*)),
this, SLOT(toggleAutoActionSelected(QAction*)));
connect(albumModel(), SIGNAL(checkStateChanged(Album*,Qt::CheckState)),
this, SLOT(slotCheckStateChange(Album*,Qt::CheckState)));
}
......@@ -242,34 +250,18 @@ void TagCheckView::addCustomContextMenuActions(ContextMenuHelper& cmh, Album* al
// automatic toggle
cmh.addAction(d->toggleAutoAction);
d->toggleNoneAction->setChecked(d->toggleAutoTags == TagCheckView::NoToggleAuto);
d->toggleChildrenAction->setChecked(d->toggleAutoTags == TagCheckView::Children);
d->toggleParentsAction->setChecked(d->toggleAutoTags == TagCheckView::Parents);
d->toggleBothAction->setChecked(d->toggleAutoTags == TagCheckView::ChildrenAndParents);
}
void TagCheckView::handleCustomContextMenuAction(QAction* action, AlbumPointer<Album> album)
{
TagFolderView::handleCustomContextMenuAction(action, album);
ToggleAutoTags toggleRestore = d->toggleAutoTags;
d->toggleAutoTags = NoToggleAuto;
if (action == d->toggleChildrenAction) // Toggle auto Children tags.
foreach(QAction* action, d->toggleAutoAction->actions())
{
toggleRestore = Children;
}
else if (action == d->toggleParentsAction) // Toggle auto Parents tags.
{
toggleRestore = Parents;
}
else if (action == d->toggleBothAction) // Toggle auto Children and Parents tags.
{
toggleRestore = ChildrenAndParents;
if (action->data().toInt() == d->toggleAutoTags)
{
action->setChecked(true);
}
}
}
d->toggleAutoTags = toggleRestore;
void TagCheckView::toggleAutoActionSelected(QAction* action)
{
d->toggleAutoTags = static_cast<ToggleAutoTags>(action->data().toInt());
}
} // namespace Digikam
......@@ -87,7 +87,6 @@ public Q_SLOTS:
protected:
virtual void addCustomContextMenuActions(ContextMenuHelper& cmh, Album* album);
virtual void handleCustomContextMenuAction(QAction* action, AlbumPointer<Album> album);
private Q_SLOTS:
......@@ -98,6 +97,7 @@ private Q_SLOTS:
void slotCheckStateChange(Album* album, Qt::CheckState state);
void slotCreatedNewTagByContextMenu(TAlbum* tag);
void toggleAutoActionSelected(QAction* action);
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment