Permalink
Browse files

Domain list improvements, copy improvements, final stuff

  • Loading branch information...
1 parent 4586190 commit 3128065a7f6d4f602952910a473fcb3ab2444f23 @cstigler cstigler committed Oct 13, 2014
View
@@ -337,7 +337,7 @@ - (BOOL)selfControlLaunchDaemonIsLoaded {
}
// If there's no block in the hosts file, no defaults BlockStartedDate, and no lock-file,
- // we'll assume we're clear of blocks. Checking ipfw would be nice but usually requires
+ // we'll assume we're clear of blocks. Checking pf would be nice but usually requires
// root permissions, so it would be difficult to do here.
return [[NSFileManager defaultManager] fileExistsAtPath: SelfControlLockFilePath];
}
@@ -354,10 +354,10 @@ - (IBAction)showDomainList:(id)sender {
return;
}
- if(domainListWindowController_ == nil)
+ if(domainListWindowController_ == nil) {
[NSBundle loadNibNamed: @"DomainList" owner: self];
- else
- [[domainListWindowController_ window] makeKeyAndOrderFront: self];
+ }
+ [domainListWindowController_ showWindow: self];
}
- (void)closeDomainList {
View
@@ -1,4 +1,4 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340
+{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\vieww9000\viewh8400\viewkind0
@@ -9,6 +9,6 @@
\
Developed by {\field{\*\fldinst{HYPERLINK "http://charliestigler.com"}}{\fldrslt Charlie Stigler}}, {\field{\*\fldinst{HYPERLINK "http://visitsteve.com/"}}{\fldrslt Steve Lambert}}, and you?\
\
-Translations: Lukas Bestle, Paul Ishii, Cynthia Lawson, Heather Rasley, Tian Zheng, and ilTofa.\
+With contributions by all of {\field{\*\fldinst{HYPERLINK "https://github.com/SelfControlApp/selfcontrol/graphs/contributors"}}{\fldrslt these lovely folks}} and translations by {\field{\*\fldinst{HYPERLINK "https://github.com/SelfControlApp/selfcontrol/wiki/Translation-Credits"}}{\fldrslt these troopers}}.\
\
Free Software created at {\field{\*\fldinst{HYPERLINK "http://eyebeam.org/"}}{\fldrslt Eyebeam}} under the {\field{\*\fldinst{HYPERLINK "http://www.gnu.org/copyleft/gpl.html"}}{\fldrslt GNU GPL}}. {\field{\*\fldinst{HYPERLINK "https://github.com/slambert/selfcontrol/"}}{\fldrslt Source code}} is available on GitHub.}
@@ -42,8 +42,12 @@ - (DomainListWindowController*)init {
return self;
}
-- (void)awakeFromNib {
+- (void)showWindow:(id)sender {
[[self window] makeKeyAndOrderFront: self];
+
+ if ([domainList_ count] == 0) {
+ [self addDomain: self];
+ }
}
- (IBAction)addDomain:(id)sender
@@ -62,6 +66,7 @@ - (IBAction)addDomain:(id)sender
- (IBAction)removeDomain:(id)sender
{
NSIndexSet* selected = [domainListTableView_ selectedRowIndexes];
+ [domainListTableView_ abortEditing];
// This isn't the most efficient way to do this, but the code is much cleaner
// than other methods and the domain blacklist will probably never be large
@@ -88,25 +93,36 @@ - (int)numberOfRowsInTableView:(NSTableView *)aTableView {
}
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {
+ if (rowIndex < 0 || rowIndex + 1 > [domainList_ count]) return nil;
return domainList_[rowIndex];
}
-- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)theObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex {
- // All of this is just code to standardize and clean up the input value.
- // This'll remove whitespace and lowercase the string.
- NSString* str = [[theObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] lowercaseString];
+- (void)controlTextDidEndEditing:(NSNotification *)note {
+ NSInteger editedRow = [domainListTableView_ editedRow];
+ NSString* editedString = [[[[note userInfo] objectForKey: @"NSFieldEditor"] textStorage] string];
+ editedString = [editedString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- if (![str length]) {
- NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex: rowIndex];
+ if (![editedString length]) {
+ NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex: editedRow];
[domainListTableView_ beginUpdates];
[domainListTableView_ removeRowsAtIndexes: indexSet withAnimation: NSTableViewAnimationSlideUp];
- [domainList_ removeObjectAtIndex: rowIndex];
+ [domainList_ removeObjectAtIndex: editedRow];
+ [domainListTableView_ reloadData];
[domainListTableView_ endUpdates];
return;
}
+}
+
+- (void)tableView:(NSTableView *)aTableView
+ setObjectValue:(NSString*)newString
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex {
+ if (rowIndex < 0 || rowIndex + 1 > [domainList_ count]) {
+ return;
+ }
+ // All of this is just code to standardize and clean up the input value.
+ // This'll remove whitespace and lowercase the string.
+ NSString* str = [[newString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] lowercaseString];
if([str rangeOfCharacterFromSet: [NSCharacterSet newlineCharacterSet]].location != NSNotFound) {
// only hits LF linebreaks, but componentsSeparatedByCharacterSet won't work on 10.4
@@ -186,9 +202,7 @@ - (void)tableView:(NSTableView *)aTableView
portNum = -1;
}
- if([str isEqual: @""] && portNum == -1)
- [domainList_ removeObjectAtIndex: rowIndex];
- else {
+ if ([str length] || portNum >= 0){
NSString* maskString;
NSString* portString;
if(maskLength == -1)
View
@@ -1,28 +1,40 @@
{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
+{\colortbl;\red255\green255\blue255;\red77\green77\blue77;\red26\green26\blue26;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{decimal\}.}{\leveltext\leveltemplateid1\'02\'00.;}{\levelnumbers\'01;}\fi-360\li720\lin720 }{\listname ;}\listid1}}
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
-\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\margl1440\margr1440\vieww8800\viewh7840\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl312\slmult1\pardirnatural
+
+\f0\fs24 \cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl264\slmult1\pardirnatural\qc
-\f0\fs48 \cf0 SelfControl helps you block your own access to distracting websites.
-\fs24 \
+\fs48 \cf2 SelfControl helps you block your own access to distracting websites.
+\fs24 \cf3 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl312\slmult1\pardirnatural
\cf0 \
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl312\slmult1\pardirnatural\qc
+
+\fs36 \cf0 \ul \ulc0 Quick Start Guide\
+
+\fs16 \ulnone \
\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\sl312\slmult1\pardirnatural
-\ls1\ilvl0\cf0 {\listtext 1. }
+\ls1\ilvl0
+\fs24 \cf0 {\listtext 1. }
\b Click "Edit Blacklist"
\b0 and add the domain names of your most distracting websites -- for example, "facebook.com". Or use the Import function to add a pre-made list of websites.\
{\listtext 2. }
\b Move the slider
\b0 to decide how long you want to block these websites for. You can change it from 15 minutes all the way up to a whole day.\
{\listtext 3. }
\b Click "Start"
-\b0 , type your password to start the block, and get studying!\
+\b0 , type your password to start the block, and get to work!\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl312\slmult1\pardirnatural
\cf0 \
+\
+\
+\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc
-\cf0 Want to learn more? Go to SelfControl's {\field{\*\fldinst{HYPERLINK "https://github.com/SelfControlApp/selfcontrol/wiki/FAQ"}}{\fldrslt FAQ page}} on GitHub.}
+\cf0 Want to learn more? See our {\field{\*\fldinst{HYPERLINK "https://github.com/SelfControlApp/selfcontrol/wiki/FAQ"}}{\fldrslt Frequently Asked Questions}}.}
Oops, something went wrong.

0 comments on commit 3128065

Please sign in to comment.