-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+ New feauture from wishlist: drag'n'drop pictures from web browser\n* F... #80
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -399,11 +399,36 @@ private void MainWindow_DragDataReceived (object o, DragDataReceivedArgs args) | |
|
||
string fullData = System.Text.Encoding.UTF8.GetString (args.SelectionData.Data); | ||
|
||
foreach (string individualFile in fullData.Split ('\n')) { | ||
string file = individualFile.Trim (); | ||
try { | ||
PintaCore.Workspace.HasOpenPendingDocuments = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not clear why HasOpenPendingDocuments is necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I remember not setting this flag up could lead to something like NullPointerException or so in case of user trying to open more than one document at the same time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO it should be removed - the only place it's checked is inside |
||
|
||
if (file.StartsWith ("file://")) | ||
PintaCore.Workspace.OpenFile (new Uri (file).LocalPath); | ||
foreach (string individualFile in fullData.Split ('\n')) { | ||
string file = individualFile.Trim (); | ||
Console.WriteLine (file); | ||
|
||
if (file.StartsWith ("http")) { | ||
System.Net.WebClient client = new System.Net.WebClient (); | ||
string tempFilePath = System.IO.Path.GetTempPath () + System.IO.Path.GetFileName(file); | ||
|
||
Console.WriteLine (">>File downloaded; " + file + "; " + tempFilePath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the error handling and progress notifications need to be improved here (e.g. showing dialogs instead of dumping messages to the console). |
||
|
||
try { | ||
client.DownloadFile (file, @tempFilePath); | ||
} finally { | ||
client.Dispose (); | ||
} | ||
|
||
if (System.IO.File.Exists (tempFilePath)) | ||
file = "file://" + tempFilePath; | ||
else | ||
Console.WriteLine ("Unable to download target file: " + tempFilePath); | ||
} | ||
|
||
if (file.StartsWith ("file://")) | ||
PintaCore.Workspace.OpenFile (new Uri (file).LocalPath); | ||
} | ||
} finally { | ||
PintaCore.Workspace.HasOpenPendingDocuments = false; | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed, since I think the bug you were trying to fix was recently fixed in master