Added LinkedIn support, Backup method for email sharing if there is no account info, If Share URL job then don't show notifications

This commit is contained in:
Jaex 2014-07-13 09:33:52 +03:00
parent cd5f8d28e7
commit 3d2b4a269f
13 changed files with 706 additions and 692 deletions

File diff suppressed because it is too large Load diff

View file

@ -514,7 +514,7 @@ private void UpdateUploaderMenuNames()
tsmiURLShorteners.Text = tsmiTrayURLShorteners.Text = "URL shortener: " + Program.DefaultTaskSettings.URLShortenerDestination.GetDescription();
tsmiURLSharingServices.Text = tsmiTrayURLSharingServices.Text = "Share URL via: " + Program.DefaultTaskSettings.SocialNetworkingServiceDestination.GetDescription();
tsmiURLSharingServices.Text = tsmiTrayURLSharingServices.Text = "URL sharing service: " + Program.DefaultTaskSettings.SocialNetworkingServiceDestination.GetDescription();
}
private void AutoCheckUpdate()

View file

@ -391,42 +391,42 @@ private void InitializeComponent()
this.tsmiURLShorteners,
this.tsmiURLSharingServices});
this.cmsDestinations.Name = "cmsDestinations";
this.cmsDestinations.Size = new System.Drawing.Size(163, 114);
this.cmsDestinations.Size = new System.Drawing.Size(182, 114);
//
// tsmiImageUploaders
//
this.tsmiImageUploaders.Image = global::ShareX.Properties.Resources.image;
this.tsmiImageUploaders.Name = "tsmiImageUploaders";
this.tsmiImageUploaders.Size = new System.Drawing.Size(162, 22);
this.tsmiImageUploaders.Size = new System.Drawing.Size(181, 22);
this.tsmiImageUploaders.Text = "Image uploaders";
//
// tsmiTextUploaders
//
this.tsmiTextUploaders.Image = global::ShareX.Properties.Resources.notebook;
this.tsmiTextUploaders.Name = "tsmiTextUploaders";
this.tsmiTextUploaders.Size = new System.Drawing.Size(162, 22);
this.tsmiTextUploaders.Size = new System.Drawing.Size(181, 22);
this.tsmiTextUploaders.Text = "Text uploaders";
//
// tsmiFileUploaders
//
this.tsmiFileUploaders.Image = global::ShareX.Properties.Resources.application_block;
this.tsmiFileUploaders.Name = "tsmiFileUploaders";
this.tsmiFileUploaders.Size = new System.Drawing.Size(162, 22);
this.tsmiFileUploaders.Size = new System.Drawing.Size(181, 22);
this.tsmiFileUploaders.Text = "File uploaders";
//
// tsmiURLShorteners
//
this.tsmiURLShorteners.Image = global::ShareX.Properties.Resources.edit_scale;
this.tsmiURLShorteners.Name = "tsmiURLShorteners";
this.tsmiURLShorteners.Size = new System.Drawing.Size(162, 22);
this.tsmiURLShorteners.Size = new System.Drawing.Size(181, 22);
this.tsmiURLShorteners.Text = "URL shorteners";
//
// tsmiURLSharingServices
//
this.tsmiURLSharingServices.Image = global::ShareX.Properties.Resources.share;
this.tsmiURLSharingServices.Image = global::ShareX.Properties.Resources.globe_share;
this.tsmiURLSharingServices.Name = "tsmiURLSharingServices";
this.tsmiURLSharingServices.Size = new System.Drawing.Size(162, 22);
this.tsmiURLSharingServices.Text = "Share URL via";
this.tsmiURLSharingServices.Size = new System.Drawing.Size(181, 22);
this.tsmiURLSharingServices.Text = "URL sharing services";
//
// btnTask
//

View file

@ -430,7 +430,7 @@ private void UpdateUploaderMenuNames()
tsmiURLShorteners.Text = "URL shortener: " + TaskSettings.URLShortenerDestination.GetDescription();
tsmiURLSharingServices.Text = "Share URL via: " + TaskSettings.SocialNetworkingServiceDestination.GetDescription();
tsmiURLSharingServices.Text = "URL sharing service: " + TaskSettings.SocialNetworkingServiceDestination.GetDescription();
}
private void tbDescription_TextChanged(object sender, EventArgs e)

View file

@ -439,6 +439,16 @@ public class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap globe_share {
get {
object obj = ResourceManager.GetObject("globe_share", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -709,16 +719,6 @@ public class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap share {
get {
object obj = ResourceManager.GetObject("share", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -172,9 +172,6 @@
<data name="wrench_screwdriver" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wrench-screwdriver.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="navigation_090_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\navigation-090-button.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="layers_ungroup" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\layers-ungroup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -196,9 +193,15 @@
<data name="image_export" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\image-export.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="au" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\au.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="application_network" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\application-network.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="application_task" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\application-task.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Polygon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Polygon.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -268,9 +271,6 @@
<data name="upload_cloud" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\upload-cloud.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="heart" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\heart.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Rectangle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Rectangle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -325,8 +325,8 @@
<data name="pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="au" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\au.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="navigation_090_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\navigation-090-button.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="layer_pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\layer--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -340,10 +340,10 @@
<data name="traffic_cone" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\traffic-cone.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="application_task" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\application-task.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="heart" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\heart.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="share" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\share.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="globe_share" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\globe-share.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

View file

@ -474,7 +474,7 @@
<None Include="Resources\heart.png" />
<None Include="Resources\crown.png" />
<None Include="Resources\layer--pencil.png" />
<None Include="Resources\share.png" />
<None Include="Resources\globe-share.png" />
<Content Include="ShareX_Icon.ico" />
<None Include="Resources\globe--pencil.png" />
<None Include="Resources\camcorder--pencil.png" />

View file

@ -296,7 +296,7 @@ private static void task_UploadCompleted(UploadTask task)
HistoryManager.AddHistoryItemAsync(Program.HistoryFilePath, info.GetHistoryItem());
}
if (!info.TaskSettings.AdvancedSettings.DisableNotifications)
if (!info.TaskSettings.AdvancedSettings.DisableNotifications && info.Job != TaskJob.ShareURL)
{
if (task.Info.TaskSettings.GeneralSettings.PlaySoundAfterUpload)
{

View file

@ -1000,34 +1000,41 @@ public void ShareURL(string url)
switch (Info.TaskSettings.SocialNetworkingServiceDestination)
{
case URLSharingServices.Email:
using (EmailForm emailForm = new EmailForm(Program.UploadersConfig.EmailRememberLastTo ? Program.UploadersConfig.EmailLastTo : string.Empty,
Program.UploadersConfig.EmailDefaultSubject, url))
if (Program.UploadersConfig.IsValid(URLSharingServices.Email))
{
if (emailForm.ShowDialog() == DialogResult.OK)
using (EmailForm emailForm = new EmailForm(Program.UploadersConfig.EmailRememberLastTo ? Program.UploadersConfig.EmailLastTo : string.Empty,
Program.UploadersConfig.EmailDefaultSubject, url))
{
if (Program.UploadersConfig.EmailRememberLastTo)
if (emailForm.ShowDialog() == DialogResult.OK)
{
Program.UploadersConfig.EmailLastTo = emailForm.ToEmail;
if (Program.UploadersConfig.EmailRememberLastTo)
{
Program.UploadersConfig.EmailLastTo = emailForm.ToEmail;
}
Email email = new Email
{
SmtpServer = Program.UploadersConfig.EmailSmtpServer,
SmtpPort = Program.UploadersConfig.EmailSmtpPort,
FromEmail = Program.UploadersConfig.EmailFrom,
Password = Program.UploadersConfig.EmailPassword
};
email.Send(emailForm.ToEmail, emailForm.Subject, emailForm.Body);
}
Email email = new Email
{
SmtpServer = Program.UploadersConfig.EmailSmtpServer,
SmtpPort = Program.UploadersConfig.EmailSmtpPort,
FromEmail = Program.UploadersConfig.EmailFrom,
Password = Program.UploadersConfig.EmailPassword
};
email.Send(emailForm.ToEmail, emailForm.Subject, emailForm.Body);
}
}
else
{
URLHelpers.OpenURL("mailto:?body=" + encodedUrl);
}
break;
case URLSharingServices.Twitter:
OAuthInfo twitterOAuth = Program.UploadersConfig.TwitterOAuthInfoList.ReturnIfValidIndex(Program.UploadersConfig.TwitterSelectedAccount);
if (twitterOAuth != null && OAuthInfo.CheckOAuth(twitterOAuth))
if (Program.UploadersConfig.IsValid(URLSharingServices.Twitter))
{
using (TwitterTweetForm twitter = new TwitterTweetForm(twitterOAuth, " " + url))
OAuthInfo twitterOAuth = Program.UploadersConfig.TwitterOAuthInfoList[Program.UploadersConfig.TwitterSelectedAccount];
using (TwitterTweetForm twitter = new TwitterTweetForm(twitterOAuth, url))
{
twitter.ShowDialog();
}
@ -1052,11 +1059,14 @@ public void ShareURL(string url)
case URLSharingServices.Tumblr:
URLHelpers.OpenURL("https://www.tumblr.com/share?v=3&u=" + encodedUrl);
break;
case URLSharingServices.LinkedIn:
URLHelpers.OpenURL("https://www.linkedin.com/shareArticle?url=" + encodedUrl);
break;
case URLSharingServices.VK:
URLHelpers.OpenURL("http://vk.com/share.php?url=" + encodedUrl);
break;
case URLSharingServices.Delicious:
URLHelpers.OpenURL("https://delicious.com/save?v=5&noui&jump=close&url=" + encodedUrl);
URLHelpers.OpenURL("https://delicious.com/save?v=5&url=" + encodedUrl);
break;
}
}

View file

@ -156,6 +156,8 @@ public enum URLSharingServices
Pinterest,
[Description("Tumblr")]
Tumblr,
[Description("LinkedIn")]
LinkedIn,
[Description("VK")]
VK,
[Description("Delicious")]

View file

@ -281,10 +281,12 @@ public bool IsValid<T>(int index)
return IsValid((UrlShortenerType)destination);
}
/*
if (destination is URLSharingServices)
{
return IsValid((URLSharingServices)destination);
}
*/
return true;
}