void LLFloaterURLEntry::callback_clear_url_list(S32 option, void* userdata) { if ( option == 0 ) // YES { LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata; if ( self ) { // clear saved list LLCtrlListInterface* url_list = self->childGetListInterface("media_entry"); if ( url_list ) { url_list->operateOnAll( LLCtrlListInterface::OP_DELETE ); } // clear current contents of combo box self->mMediaURLEdit->clear(); // clear stored version of list LLURLHistory::clear("parcel"); // cleared the list so disable Clear button self->childSetEnabled( "clear_btn", false ); } } }
// static //----------------------------------------------------------------------------- // onBtnOK() //----------------------------------------------------------------------------- void LLFloaterURLEntry::onBtnOK( void* userdata ) { LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata; std::string media_url = self->mMediaURLEdit->getValue().asString(); self->mMediaURLEdit->remove(media_url); LLURLHistory::removeURL("parcel", media_url); if(self->addURLToCombobox(media_url)) { // Add this url to the parcel collection LLURLHistory::addURL("parcel", media_url); } // leading whitespace causes problems with the MIME-type detection so strip it LLStringUtil::trim( media_url ); // First check the URL scheme LLURI url(media_url); std::string scheme = url.scheme(); // We assume that an empty scheme is an http url, as this is how we will treat it. if(scheme == "") { scheme = "http"; } // Discover the MIME type only for "http" scheme. if(!media_url.empty() && (scheme == "http" || scheme == "https")) { LLHTTPClient::getHeaderOnly( media_url, new LLMediaTypeResponder(self->getHandle())); } else { self->headerFetchComplete(0, scheme); } // Grey the buttons until we get the header response self->getChildView("ok_btn")->setEnabled(false); self->getChildView("cancel_btn")->setEnabled(false); self->getChildView("media_entry")->setEnabled(false); // show progress bar here? getWindow()->incBusyCount(); self->getChildView("loading_label")->setVisible( true); }
// static //----------------------------------------------------------------------------- // onBtnCancel() //----------------------------------------------------------------------------- void LLFloaterURLEntry::onBtnCancel( void* userdata ) { LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata; self->closeFloater(); }