• R/O
  • SSH
  • HTTPS

chattr: コミット


コミットメタ情報

リビジョン271 (tree)
日時2011-10-09 19:49:14
作者ichi

ログメッセージ

OAuthでPINコードを認識できない場合はコピー&ペーストで入力できるよう修正

変更サマリ

差分

--- Chattr/trunk/Chattr/FormOAuth.Designer.cs (revision 270)
+++ Chattr/trunk/Chattr/FormOAuth.Designer.cs (revision 271)
@@ -33,6 +33,7 @@
3333 this.webBrowser = new System.Windows.Forms.WebBrowser();
3434 this.buttonOK = new System.Windows.Forms.Button();
3535 this.buttonCancel = new System.Windows.Forms.Button();
36+ this.textBox = new System.Windows.Forms.TextBox();
3637 this.panel.SuspendLayout();
3738 this.SuspendLayout();
3839 //
@@ -40,9 +41,9 @@
4041 //
4142 this.panel.Controls.Add(this.webBrowser);
4243 this.panel.Font = new System.Drawing.Font("Meiryo UI", 9F);
43- this.panel.Location = new System.Drawing.Point(12, 12);
44+ this.panel.Location = new System.Drawing.Point(10, 10);
4445 this.panel.Name = "panel";
45- this.panel.Size = new System.Drawing.Size(770, 510);
46+ this.panel.Size = new System.Drawing.Size(660, 437);
4647 this.panel.TabIndex = 0;
4748 //
4849 // webBrowser
@@ -49,9 +50,9 @@
4950 //
5051 this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
5152 this.webBrowser.Location = new System.Drawing.Point(0, 0);
52- this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
53+ this.webBrowser.MinimumSize = new System.Drawing.Size(17, 17);
5354 this.webBrowser.Name = "webBrowser";
54- this.webBrowser.Size = new System.Drawing.Size(770, 510);
55+ this.webBrowser.Size = new System.Drawing.Size(660, 437);
5556 this.webBrowser.TabIndex = 0;
5657 this.webBrowser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser_DocumentCompleted);
5758 //
@@ -59,31 +60,41 @@
5960 //
6061 this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
6162 this.buttonOK.Font = new System.Drawing.Font("Meiryo UI", 9F);
62- this.buttonOK.Location = new System.Drawing.Point(602, 528);
63+ this.buttonOK.Location = new System.Drawing.Point(516, 453);
6364 this.buttonOK.Name = "buttonOK";
64- this.buttonOK.Size = new System.Drawing.Size(87, 29);
65+ this.buttonOK.Size = new System.Drawing.Size(75, 25);
6566 this.buttonOK.TabIndex = 1;
6667 this.buttonOK.Text = "OK";
6768 this.buttonOK.UseVisualStyleBackColor = true;
69+ this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
6870 //
6971 // buttonCancel
7072 //
7173 this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
7274 this.buttonCancel.Font = new System.Drawing.Font("Meiryo UI", 9F);
73- this.buttonCancel.Location = new System.Drawing.Point(695, 528);
75+ this.buttonCancel.Location = new System.Drawing.Point(596, 453);
7476 this.buttonCancel.Name = "buttonCancel";
75- this.buttonCancel.Size = new System.Drawing.Size(87, 29);
77+ this.buttonCancel.Size = new System.Drawing.Size(75, 25);
7678 this.buttonCancel.TabIndex = 2;
7779 this.buttonCancel.Text = "Cancel";
7880 this.buttonCancel.UseVisualStyleBackColor = true;
7981 //
82+ // textBox
83+ //
84+ this.textBox.Location = new System.Drawing.Point(350, 457);
85+ this.textBox.Name = "textBox";
86+ this.textBox.Size = new System.Drawing.Size(160, 19);
87+ this.textBox.TabIndex = 3;
88+ this.textBox.TextChanged += new System.EventHandler(this.textBox_TextChanged);
89+ //
8090 // FormOAuth
8191 //
8292 this.AcceptButton = this.buttonOK;
83- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
93+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
8494 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
8595 this.CancelButton = this.buttonCancel;
86- this.ClientSize = new System.Drawing.Size(794, 569);
96+ this.ClientSize = new System.Drawing.Size(681, 488);
97+ this.Controls.Add(this.textBox);
8798 this.Controls.Add(this.buttonCancel);
8899 this.Controls.Add(this.buttonOK);
89100 this.Controls.Add(this.panel);
@@ -94,9 +105,11 @@
94105 this.Name = "FormOAuth";
95106 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
96107 this.Text = "OAuth認証";
108+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormOAuth_FormClosing);
97109 this.Load += new System.EventHandler(this.FormOAuth_Load);
98110 this.panel.ResumeLayout(false);
99111 this.ResumeLayout(false);
112+ this.PerformLayout();
100113
101114 }
102115
@@ -106,5 +119,6 @@
106119 private System.Windows.Forms.Button buttonOK;
107120 private System.Windows.Forms.Button buttonCancel;
108121 private System.Windows.Forms.WebBrowser webBrowser;
122+ private System.Windows.Forms.TextBox textBox;
109123 }
110124 }
\ No newline at end of file
--- Chattr/trunk/Chattr/FormOAuth.cs (revision 270)
+++ Chattr/trunk/Chattr/FormOAuth.cs (revision 271)
@@ -32,8 +32,8 @@
3232 WebBrowser web = sender as WebBrowser;
3333 Debug.WriteLine("DocumentCompleted: " + web.Document.Url);
3434 if (web.Document.Url.AbsoluteUri == TwitterOAuth.AUTHORIZE_URL)
35- {
36- Match m = Regex.Match(web.DocumentText, "\\<div id=\"oauth_pin\"\\>\\s+(.*?)\\s+", RegexOptions.Multiline);
35+ { //<kbd aria-labelledby="code-desc"><code>5536925</code></kbd>
36+ Match m = Regex.Match(web.DocumentText, "\\<kbd aria-labelledby=\"code-desc\"\\>\\<code\\>(.*?)\\</code\\>\\</kbd\\>", RegexOptions.Multiline);
3737 if (m.Success)
3838 {
3939 Debug.WriteLine(m.Groups[0]);
@@ -40,17 +40,42 @@
4040 if (m.Groups.Count > 1)
4141 {
4242 Debug.WriteLine("'" + m.Groups[1] + "'");
43- String token = TwitterOAuth.access_token(m.Groups[1].Value);
44- if (token != "")
45- {
46- String[] access_token = token.Split(new String[] { ":" }, StringSplitOptions.None);
47- m_Prefs.SetAccessToken(access_token[0]);
48- m_Prefs.SetAccessTokenSecret(access_token[1]);
49- buttonOK.Enabled = true;
50- }
43+ textBox.Text = m.Groups[1].Value;
5144 }
5245 }
5346 }
5447 }
48+
49+ private void textBox_TextChanged(object sender, EventArgs e)
50+ {
51+ Debug.WriteLine("TextChanged: '" + textBox.Text + "'");
52+ Match m = Regex.Match(textBox.Text, "^[0-9]+$", RegexOptions.Multiline);
53+ if (m.Success)
54+ {
55+ buttonOK.Enabled = true;
56+ }
57+ }
58+
59+ private void buttonOK_Click(object sender, EventArgs e)
60+ {
61+ Debug.WriteLine("OK_Click");
62+ Match m = Regex.Match(textBox.Text, "^[0-9]+$", RegexOptions.Multiline);
63+ if (m.Success)
64+ {
65+ Debug.WriteLine("OK_Click: '"+ textBox.Text + "'");
66+ String token = TwitterOAuth.access_token(textBox.Text);
67+ if (token != "")
68+ {
69+ String[] access_token = token.Split(new String[] { ":" }, StringSplitOptions.None);
70+ m_Prefs.SetAccessToken(access_token[0]);
71+ m_Prefs.SetAccessTokenSecret(access_token[1]);
72+ }
73+ }
74+ }
75+
76+ private void FormOAuth_FormClosing(object sender, FormClosingEventArgs e)
77+ {
78+ Debug.WriteLine("FormClosing");
79+ }
5580 }
5681 }
旧リポジトリブラウザで表示