Browse files

Make server/channel lists have Command-0 as the 10th shortcut

  • Loading branch information...
1 parent e91a2b9 commit 91c6e8f8c0f7c0ede9c27ef27952b26f24e646f3 @daagaak daagaak committed Sep 2, 2009
Showing with 10 additions and 4 deletions.
  1. +10 −4 Source/Controllers/AppController.m
View
14 Source/Controllers/AppController.m
@@ -605,8 +605,14 @@ - (void)newTabWithWindowRec:(WINDOW_REC *)wind
/* Update up channel menu */
int channelCount = [tabView numberOfTabViewItems];
- NSString *keyEquivalent = (channelCount < 10) ? [[NSNumber numberWithInt:channelCount] stringValue] : @"";
- NSMenuItem *newMenuItem = [[NSMenuItem alloc] initWithTitle:label action:@selector(gotoChannel:) keyEquivalent:keyEquivalent];
+ NSMenuItem *newMenuItem = [[NSMenuItem alloc] initWithTitle:label action:@selector(gotoChannel:) keyEquivalent:@""];
+
+ if (channelCount <= 10)
+ {
+ [newMenuItem setKeyEquivalent:[[NSNumber numberWithInt:(channelCount % 10)] stringValue]];
+ [newMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
+ }
+
[newMenuItem setTarget:self];
[channelMenu addItem:newMenuItem];
[newMenuItem release];
@@ -1095,11 +1101,11 @@ - (void)irssiServerChangedNotification:(NSNotification*)notification
action:@selector(changeIrssiServerConsole:)
keyEquivalent:@""
tag:*(int*)&server];
- if (count < 10)
+ if (count <= 10)
{
// Not sure Command+Option+10 works too well ;). We could check here if we're gonna collide with a user
// shortcut but maybe some other time.
- [[serversMenu itemWithTag:*(int*)&server] setKeyEquivalent:[NSString stringWithFormat:@"%d", count++]];
+ [[serversMenu itemWithTag:*(int*)&server] setKeyEquivalent:[NSString stringWithFormat:@"%d", (count++) % 10]];
[[serversMenu itemWithTag:*(int*)&server] setKeyEquivalentModifierMask:NSCommandKeyMask|NSAlternateKeyMask];
}
[[serversMenu itemWithTag:*(int*)&server] setState:(activeServerRec == server)];

0 comments on commit 91c6e8f

Please sign in to comment.