Ticket #3825: PeopleUrlFix.patch
File PeopleUrlFix.patch, 1.9 KB (added by , 14 years ago) |
---|
-
BFSBackup/haiku/haiku/src/apps/people/TTextControl.h
22 22 ~TTextControl(); 23 23 24 24 virtual void AttachedToWindow(void); 25 virtual void MouseDown(BPoint); 25 26 26 27 bool Changed(void); 27 28 void Revert(void); 28 29 void Update(void); 30 void LoadURLField(const char*); 29 31 30 32 private: 31 33 char *fOriginal; -
BFSBackup/haiku/haiku/src/apps/people/TTextControl.cpp
10 10 This file may be used under the terms of the Be Sample Code License. 11 11 */ 12 12 13 #include <Roster.h> 14 #include <StorageKit.h> 15 #include <support/String.h> 16 13 17 #include <string.h> 14 18 #include <malloc.h> 15 19 #include <Font.h> … … 57 61 } 58 62 59 63 64 void 65 TTextControl::MouseDown(BPoint linkagePosition) 66 { 67 if ((linkagePosition.x > 60 && linkagePosition.x < 85) 68 && (linkagePosition.y > 5 && linkagePosition.y < 15)) 69 LoadURLField(this->Text()); 70 } 71 72 60 73 bool 61 74 TTextControl::Changed(void) 62 75 { … … 78 91 fOriginal = (char *)realloc(fOriginal, strlen(Text()) + 1); 79 92 strcpy(fOriginal, Text()); 80 93 } 94 95 96 void 97 TTextControl::LoadURLField(const char *fUrl) 98 { 99 BString argument(fUrl); 100 101 if (argument.IFindLast("www",3) == 0) 102 argument.Prepend("http://"); 103 104 const char *largs[] = {argument.String(), 0}; 105 106 if (argument.IFindFirst("http://") == 0) { 107 BString mimeType = "application/x-vnd.Be.URL."; 108 mimeType.Append(argument, argument.FindFirst(':')); 109 if (!BMimeType::IsValid(mimeType.String())) 110 return; 111 be_roster->Launch(mimeType.String(), 1, const_cast<char **>(largs)); 112 } 113 } 114