#include <dbgthumb.h>
Inheritance diagram for OpURLImport:
Public Member Functions | |
OpURLImport () | |
Default constructor. | |
void | Do (OpDescriptor *) |
Imports a URL into the current document. | |
OpURLImport () | |
void | Do (OpDescriptor *) |
Imports a file into the current document. | |
Static Public Member Functions | |
static BOOL | Init () |
Declares the OpDescriptor. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
This item is always available, so long as a document is visible. | |
static BOOL | Init () |
Declares op descriptors for Acorn Draw file reading. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
This item is always available, so long as a document is visible. | |
Protected Member Functions | |
BOOL | ImportURL (WebAddress urlToGet) |
Imports the URL given. | |
Filter * | GetAllFilter () |
Gets a pointer to the All filter. | |
BOOL | ImportURL (WebAddress urlToGet) |
Filter * | GetAllFilter () |
Definition at line 123 of file dbgthumb.h.
|
Default constructor.
Definition at line 219 of file dbgthumb.cpp. 00220 { 00221 OpFlags.HasOwnTimeIndicator = TRUE; // The OpURLImport op has its own time indicator 00222 }
|
|
|
|
Imports a file into the current document.
Reimplemented from OpMenuImport. |
|
Imports a URL into the current document.
Reimplemented from OpMenuImport. Definition at line 164 of file dbgthumb.cpp. 00165 { 00166 //First display our Import from URL dialog and get a filename from it 00167 WebAddress urlToGet; 00168 00169 BOOL ok=URLImportDlg::OpenAndGetURL(&urlToGet); 00170 00171 //And if the user clicked OK 00172 if (ok) 00173 { 00174 00175 //So, is the URL we've got back a local filename? 00176 if (urlToGet.IsLocalFile()) 00177 { 00178 //Yes. So get it as a pathname 00179 PathName pthToGet=urlToGet.GetPathName(); 00180 00181 //And first get a pointer to the All filter 00182 Filter* pAllFilter=GetAllFilter(); 00183 00184 //And if we found it 00185 if (pAllFilter) 00186 { 00187 //Then import the pathname 00188 String_256 strToGet=pthToGet.GetPath(); 00189 00190 DoImport(pthToGet, pAllFilter, &strToGet); 00191 } 00192 00193 } 00194 else 00195 { 00196 //No, it's a URL. 00197 00198 //So download it 00199 ImportURL(urlToGet); 00200 } 00201 } 00202 00203 00204 00205 00206 00207 }
|
|
|
|
Gets a pointer to the All filter.
Definition at line 347 of file dbgthumb.cpp. 00348 { 00349 //So get a pointer to the All filter 00350 FilterManager* pFilterManager=Camelot.GetFilterManager(); 00351 00352 ERROR2IF(pFilterManager==NULL, FALSE, "OpURLImport::ImportURL - FilterManager does not exist"); 00353 00354 return pFilterManager->FindFilterFromID(FILTERID_GENERIC); 00355 00356 }
|
|
This item is always available, so long as a document is visible.
Reimplemented from OpMenuImport. |
|
This item is always available, so long as a document is visible.
Reimplemented from OpMenuImport. Definition at line 234 of file dbgthumb.cpp. 00235 { 00236 OpState OpSt; 00237 00238 return OpSt; 00239 }
|
|
|
|
Imports the URL given.
Definition at line 261 of file dbgthumb.cpp. 00262 { 00263 //First, set up some variables. We must do this now because I'm 00264 //going to use a goto in a moment 00265 GenericDownloadParam* Param; 00266 OpDescriptor* pOpDesc; 00267 PathName pthTemp; 00268 00269 //We want to import urlToGet using the best available filter 00270 00271 //To get the best available filter, we simply download to the "All" filter 00272 //So get a pointer to the All filter 00273 Filter* pAllFilter=GetAllFilter(); 00274 00275 //Check we found it 00276 if (pAllFilter==NULL) 00277 goto ReturnError; 00278 00279 //Now, get ready to download the file. This is rather complex. 00280 00281 //First create a new set of download parameters 00282 //This object will be deleted when the download finishes 00283 Param = new GenericDownloadParam; 00284 00285 //Now find the generic download OpDescriptor 00286 pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_OPGENERICDOWNLOAD); 00287 00288 //And check we found it 00289 if (pOpDesc==NULL) 00290 goto ReturnError; 00291 00292 //Now, create a temporary file to download to 00293 pthTemp=FileUtil::GetTemporaryPathName(); 00294 00295 00296 00297 /* GTODO: Take all this out 00298 TCHAR TempDir[MAX_PATH]; 00299 FileUtil::GetTemporaryPath(MAX_PATH,TempDir); 00300 // get temp file name 00301 TCHAR TempFileName[256]; 00302 TCHAR Prefix[] = "TMP"; // the first three letters of the new file name 00303 FileUtil::GetTemporaryFileName(TempDir,Prefix,0,TempFileName); 00304 */ 00305 00306 //And now fill in our parameters 00307 Param->type = TYPE_GENERIC; 00308 Param->priority = AsynchDownload::PRIORITY_NORMAL; 00309 Param->strDescription = String_256(_R(IDS_HTMLIMPORT_FILEDOWNLOAD)); 00310 Param->uCaptionID = _R(IDS_GENERICPROGRESSDLGCAPTION); 00311 Param->uErrorMsgID = _R(IDS_GENERICDOWNLOADFAILED); 00312 Param->file = pthTemp.GetPath(); 00313 00314 Param->strURL = urlToGet.GetWebAddress(); 00315 00316 Param->Output = NULL; 00317 00318 Param->m_pFilter = pAllFilter; 00319 Param->m_Op = this; 00320 Param->pDoc = Document::GetCurrent(); 00321 00322 //And, finally, start the download going, if we've got a URL to download 00323 if (!Param->strURL.IsEmpty()) 00324 pOpDesc->Invoke((OpParam*) Param); 00325 00326 //And return TRUE 00327 return TRUE; 00328 00329 ReturnError: 00330 if (Param) 00331 delete Param; 00332 00333 return FALSE; 00334 }
|
|
Declares op descriptors for Acorn Draw file reading.
Reimplemented from OpMenuImport. |
|
Declares the OpDescriptor.
Reimplemented from OpMenuImport. Definition at line 131 of file dbgthumb.cpp. 00132 { 00133 return RegisterOpDescriptor( 00134 0, // Tool ID 00135 _R(IDS_URLIMPORT), // String resource ID 00136 CC_RUNTIME_CLASS(OpURLImport), // Runtime class 00137 OPTOKEN_URLIMPORT, // Token string 00138 GetState, // GetState function 00139 0, // help ID GTODO: Is this needed? 00140 _R(IDBBL_URLIMPORT), // bubble help 00141 _R(IDD_BARCONTROLSTORE), // resource ID 00142 _R(IDC_FILEURLIMPORT), // control ID 00143 SYSTEMBAR_FILE, // Bar ID 00144 TRUE, // Receive system messages 00145 FALSE, // Smart duplicate operation 00146 TRUE, // Clean operation 00147 0, // String for one copy only error 00148 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags 00149 ); 00150 00151 }
|