Archived
1

Implemented censored names preference

Added case sensitivity preference
Integer tags are not clearable anymore
This commit is contained in:
Kim Wittenburg
2015-09-14 00:43:01 +02:00
committed by Kim Wittenburg
parent e2bdcd21e5
commit 257a7811d6
10 changed files with 277 additions and 109 deletions

View File

@@ -81,17 +81,28 @@ internal class TagsPreferencesViewController: NSViewController, NSTableViewDataS
if tag.isReturnedBySearchAPI {
popupButton?.addItemWithTitle(NSLocalizedString("Save", comment: "Menu item title for a tag that is going to be saved"))
}
popupButton?.addItemsWithTitles([
NSLocalizedString("Clear", comment: "Menu item title for a tag that is going to be cleared"),
NSLocalizedString("Ignore", comment: "Menu item title for a tag that is not going to be saved")])
if tag.clearable {
popupButton?.addItemWithTitle(NSLocalizedString("Clear", comment: "Menu item title for a tag that is going to be cleared"))
}
popupButton?.addItemWithTitle(NSLocalizedString("Ignore", comment: "Menu item title for a tag that is not going to be saved"))
var selectedIndex: Int
switch Preferences.sharedPreferences.tagSavingBehaviors[tag]! {
case .Save:
selectedIndex = 0
case .Clear:
selectedIndex = tag.isReturnedBySearchAPI ? 1 : 0
selectedIndex = 1
if !tag.isReturnedBySearchAPI {
--selectedIndex
}
case .Ignore:
selectedIndex = tag.isReturnedBySearchAPI ? 2 : 1
selectedIndex = 2
if !tag.isReturnedBySearchAPI {
--selectedIndex
}
if !tag.clearable {
--selectedIndex
}
}
popupButton?.selectItemAtIndex(selectedIndex)
return popupButton
@@ -105,9 +116,22 @@ internal class TagsPreferencesViewController: NSViewController, NSTableViewDataS
var savingBehavior = Preferences.sharedPreferences.tagSavingBehaviors[tag]!
switch selectedIndex {
case 0:
savingBehavior = tag.isReturnedBySearchAPI ? .Save : .Clear
if tag.isReturnedBySearchAPI {
savingBehavior = .Save
} else if tag.clearable {
savingBehavior = .Clear
} else {
savingBehavior = .Ignore
}
case 1:
savingBehavior = tag.isReturnedBySearchAPI ? .Clear : .Ignore
if tag.isReturnedBySearchAPI {
if tag.clearable {
savingBehavior = .Clear
} else {
savingBehavior = .Ignore
}
}
savingBehavior = .Ignore
case 2:
savingBehavior = .Ignore
default: