Example #1
0
String Path::ExtractPathFromCmdLine(String& input)
{
	String r;
	input.Trim();
	bool q = input[0] == '"';
	size_t i = q ? 1 : 0;
	while(i < input.size())
	{
		if(q)
		{
			if(input[i] == '"')
			{
				break;
			}
		}
		else
		{
			if(input[i] == ' ')
			{
				break;
			}
		}
		r += input[i];
		i++;
	}
	input.erase(input.begin(), input.begin() + r.size() + (q ? 2 : 0));
	input.Trim();
	return r;
}
Example #2
0
AutoPtr<ITimeZone> TimeZone::GetDefault()
{
    if (sDefaultTimeZone == NULL) {
        AutoPtr<ITimeZoneGetter> tzGetter = TimeZoneGetter::GetInstance();
        String zoneName;
        if (tzGetter != NULL) {
            tzGetter->GetId(&zoneName);
        }
        if (!zoneName.IsNull()) {
            zoneName = zoneName.Trim();
        }
        if (!zoneName.IsNull() || zoneName.IsEmpty()) {
            // try {
                // On the host, we can find the configured timezone here.
            ECode ec = IoUtils::ReadFileAsString(String("/etc/timezone"), &zoneName);
            // } catch (IOException ex) {
                // "vogar --mode device" can end up here.
                // TODO: give libcore access to Android system properties and read "persist.sys.timezone".
            if (FAILED(ec)) {
                zoneName = String("GMT");
            }
            // }
        }
        TimeZone::GetTimeZone(zoneName, (ITimeZone**)&sDefaultTimeZone);
    }

    AutoPtr<ITimeZone> tz;
    sDefaultTimeZone->Clone((ITimeZone**)&tz);
    return tz;
}
/* This little program demonstrates the parsing of IPAddress strings */
int main(int argc, char ** argv)
{
   CompleteSetupSystem css;

   PrintExampleDescription();

   while(1)
   {
      printf("Please enter a string representing an IPv4 or IPv6 numeric host-address: ");
      fflush(stdout);

      char buf[1024];
      (void) fgets(buf, sizeof(buf), stdin);

      String s = buf;
      s = s.Trim();  // get rid of newline ugliness

      IPAddress ip;
      if (ip.SetFromString(s) == B_NO_ERROR)
      {
         printf("I parsed the string [%s] as IPAddress %s\n", s(), ip.ToString()());
         printf("    ip.IsValid() returned %i\n", ip.IsValid());
         printf("    ip.IsIPv4() returned %i\n", ip.IsIPv4());
         printf("    ip.IsMulticast() returned %i\n", ip.IsMulticast());
         printf("    ip.IsStandardLoopbackAddress() returned %i\n", ip.IsStandardLoopbackDeviceAddress());
         printf("\n");
      }
      else printf("Error, couldn't parse [%s] as an IPAddress!\n", s());
   }
   return 0;
}
void ExtractAlphaChannelsInterface::__ChannelList_EditCompleted( Edit& sender )
{
   try
   {
      String s = sender.Text();
      s.Trim();

      SortedArray<int> list;
      ExtractAlphaChannelsInstance::ParseChannelList( list, s );

      s.Clear();
      for ( size_type i = 0; ; )
      {
         s.Append( String( list[i] ) );
         if ( ++i == list.Length() )
            break;
         s.Append( ',' );
      }

      instance.channelList = s;
      sender.SetText( s );
   }

   ERROR_CLEANUP(
      sender.SetText( instance.channelList );
      sender.SelectAll();
      sender.Focus()
   )
}
ECode HttpURLConnection::GetResponseCode(
    /* [out] */ Int32* responseCode)
{
    VALIDATE_NOT_NULL(responseCode)

    // Call getInputStream() first since getHeaderField() doesn't return
    // exceptions
    AutoPtr<IInputStream> is;
    FAIL_RETURN(GetInputStream((IInputStream**)&is));
    String response;
    GetHeaderField(0, &response);
    if (response.IsNull()) {
        *responseCode = -1;
        return NOERROR;
    }
    response = response.Trim();
    Int32 mark = response.IndexOf(" ") + 1;
    if (mark == 0) {
        *responseCode = -1;
        return NOERROR;
    }
    Int32 last = mark + 3;
    if (last > response.GetLength()) {
        last = response.GetLength();
    }
    mResponseCode = StringUtils::ParseInt32(response.Substring(mark, last));
    if ((last + 1) <= response.GetLength()) {
        mResponseMessage = response.Substring(last + 1);
    }
    *responseCode = mResponseCode;
    return NOERROR;
}
Example #6
0
String TForm3::Format(String s)
{
if (s.Trim()=="") {return s;}
int length=LE->Text.Length();
//1 произвести замены
bool replace=false;
for (int i=1; i<SG->RowCount-1&&!replace; i++)
	{
	String r=Replace(s,SG->Cells[0][i],SG->Cells[1][i]);
	if (s!=r)
		{
		replace=true;
		s=r;
		}
	}
if (replace)
	{
	s=Replace(s,".","");
	s=Replace(s,"-","");
	s=Replace(s,",","");
	s=Replace(s,":","");

		//2 форматировать как на образце
		int k=0;
		for (int i=1; i<=length; i++)
			{
			if (LE->Text.SubString(i,1)!="_")
				{
				s.Insert(LE->Text.SubString(i,1),i+k);
				//k++;
				}
			}
	}
return s.SubString(1,length);
}
Example #7
0
String __fastcall ASEditDataSetAttachment::getFilePath(String asID){
	String lsPath = "";
	lsPath = fEditorDS->DataSetSvr->Values[fFilePathExp] ;
	if(lsPath.Trim().IsEmpty()) throw Exception("没有制定附件或图片文件名称");
	String lsDir = ExtractFileDir(lsPath);
	if(!DirectoryExists(lsDir))
		if(!ForceDirectories(lsDir)) throw Exception("无法创建数据文件路径"+ lsDir);
	return lsPath;
}
Example #8
0
Vector<String> Path::SplitCommandLine(int argc, char** argv)
{
	Vector<String> res;
	for(int i = 0; i < argc; i++)
	{
		String a = argv[i];
		a.Trim();
		if(!a.empty())
			res.push_back(a);
	}
	return res;
}
Example #9
0
Vector<String> Path::SplitCommandLine(const String& input)
{
	String buffer = input;
	Vector<String> res;
	while(!buffer.empty())
	{
		String a = ExtractPathFromCmdLine(buffer);
		a.Trim();
		if(!a.empty())
			res.push_back(a);
	}
	return res;
}
Example #10
0
   void LoadFiltersFromGlobalString( const IsoString& globalKey )
   {
      filters.Clear();

      String s = PixInsightSettings::GlobalString( globalKey  );
      if ( !s.IsEmpty() )
      {
         for ( size_type p = 0; ; )
         {
            size_type p1 = s.Find( '(', p );
            if ( p1 == String::notFound )
               break;

            size_type p2 = s.Find( ')', p1 );
            if ( p2 == String::notFound )
               break;

            String extStr = s.Substring( p1, p2-p1 );
            if ( !extStr.IsEmpty() )
            {
               StringList extLst;
               extStr.Break( extLst, ' ', true );
               if ( !extLst.IsEmpty() )
               {
                  FileFilter filter;

                  for ( StringList::const_iterator i = extLst.Begin(); i != extLst.End(); ++i )
                  {
                     size_type d = i->Find( '.' );
                     if ( d != String::notFound )
                        filter.AddExtension( i->Substring( d ) );
                  }

                  if ( !filter.Extensions().IsEmpty() )
                  {
                     String desc = s.Substring( p, p1-p );
                     desc.Trim();
                     filter.SetDescription( desc );

                     filters.Add( filter );
                  }
               }
            }

            p = p2 + 1;
         }
      }
   }
ECode AppWidgetProviderInfo::LoadLabel(
    /* [in] */ IPackageManager* packageManager,
    /* [out] */ String* result)
{
    VALIDATE_NOT_NULL(result);
    AutoPtr<ICharSequence> label;
    IPackageItemInfo::Probe(mProviderInfo)->LoadLabel(packageManager, (ICharSequence**)&label);
    if (label != NULL) {
        String str;
        label->ToString(&str);
        *result = str.Trim();
        return NOERROR;
    }
    *result = NULL;
    return NOERROR;
}
Example #12
0
/**
 * Get cookie(s) for a given url so that it can be set to "cookie:" in http
 * request header.
 * @param url The url needs cookie
 * @return The cookies in the format of NAME=VALUE [; NAME=VALUE]
 */
String AwCookieManager::GetCookie(
    /* [in] */ const String& url)
{
    String cookie = NativeGetCookie(url);
    // Return null if the string is empty to match legacy behavior
    //return cookie == NULL || cookie.Trim().IsEmpty() ? NULL : cookie;
    if (cookie.IsNullOrEmpty())
    {
        return String(NULL);
    }
    if (cookie.Trim().IsEmpty())
    {
        return String(NULL);
    }
    return cookie;
}
Example #13
0
void Dtime::Time_Label (string label, Units_Type time_format)
{
	String time;

	if (time_format == NO_UNITS) time_format = Time_Format ();

	dtime = 0;
	time = label;
	time.Trim (" \t");

	if (time.empty ()) {
		exe->Warning ("Time Label Conversion ");
		return;
	}
	if (time.find_first_of (".:") == time.npos) {
		size_t len = time.length ();
			
		//---- scan for clock time ----

		if (len >= 3 && len <= 4) {
			bool flag = false;

			if (time [0] == '0') {
				flag = true;
			} else if (len == 4) {
				if (time [0] <= '2' && time [2] <= '5') {
					flag = true;
				}
			} else if (time [1] <= '5') {
				flag = true;
			}
			if (flag) {
				if (len == 4) {
					time.insert (2, ":");
				} else {
					time.insert (1, ":");
				}
			}
		}
	}
	Time_String (time, time_format);
	return;
}
void ImageIdentifierInterface::__EditCompleted( Edit& sender )
{
   try
   {
      String newId = sender.Text();
      newId.Trim();

      // The identifier can either be empty, meaning that a default image
      // identifier will be set by the PixInsight application, or a valid
      // C identifier.
      if ( !newId.IsEmpty() && !newId.IsValidIdentifier() )
         throw Error( '\'' + newId + "': Invalid identifier" );

      instance.SetId( newId );
      UpdateControls();
   }
   ERROR_CLEANUP(
      UpdateControls();
      )
}
Example #15
0
void NewImageInterface::__Identifier_EditCompleted( Edit& sender )
{
   try
   {
      String id = sender.Text();
      id.Trim();

      if ( !id.IsEmpty() && id != AUTO_ID && !id.IsValidIdentifier() )
         throw Error( "Invalid identifier: " + id );

      instance.id = (id != AUTO_ID) ? id : String();
      sender.SetText( instance.id.IsEmpty() ? AUTO_ID : instance.id );
      return;
   }

   ERROR_CLEANUP(
      sender.SetText( instance.id );
      sender.SelectAll();
      sender.Focus()
   )
}
Example #16
0
static String StringTrim()
{
	ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
	String self = vframe->Self;
	return self.Trim();
}
Example #17
0
ScanResult* ParseScanResult(String line)
{
    if (line.IsNullOrEmpty()) {
        return NULL;
    }

    ScanResult* scanResult = NULL;

    /*
     * Cache implementation (LinkedHashMap) is not synchronized, thus,
     * must synchronized here!
     */
    String result[5];
    int resultCount = 0;

    AutoPtr<ArrayOf<Char32> > chars = line.GetChars();
    int lineLen = chars->GetLength();
    for (int tabBeg = 0, tabEnd = 0; tabEnd <= lineLen; ++tabEnd) {
        if (tabEnd == lineLen || (*chars)[tabEnd] == '\t') {
            if (tabEnd > tabBeg) {
                result[resultCount] = line.Substring(tabBeg, tabEnd);
                ++resultCount;
            }
            tabBeg = tabEnd + 1;
        }
    }

    if (3 <= resultCount && resultCount <= 5) {
        //String bssid = result[0];
        // bssid | frequency | level | flags | ssid
        // int frequency;
        // int level;
        // try {
        //     frequency = Integer.parseInt(result[1]);
        //     level = Integer.parseInt(result[2]);
            /* some implementations avoid negative values by adding 256
             * so we need to adjust for that here.
             */
        //     if (level > 0) level -= 256;
        // } catch (NumberFormatException e) {
        //     frequency = 0;
        //     level = 0;
        // }

        /*
         * The formatting of the results returned by
         * wpa_supplicant is intended to make the fields
         * line up nicely when printed,
         * not to make them easy to parse. So we have to
         * apply some heuristics to figure out which field
         * is the SSID and which field is the flags.
         */
        String ssid;
        String flags;
        if (resultCount == 4) {
            if (result[3].GetChar(0) == '[') {
                flags = result[3];
                ssid = "";
            }
            else {
                flags = "";
                ssid = result[3];
            }
        }
        else if (resultCount == 5) {
            flags = result[3];
            ssid = result[4];
        }
        else {
            // Here, we must have 3 fields: no flags and ssid
            // set
            flags = "";
            ssid = "";
        }

        // Do not add scan results that have no SSID set
        if (0 < ssid.Trim().GetLength()) {
            int security = -1;
            if (flags.Contains("WPA-PSK") || flags.Contains("WPA2-PSK"))
                security = 0;
            else if (flags.Contains("WEP"))
                security = 1;
            else if (flags.Contains("WPA2-EAP"))
                return NULL;//TODO:
            scanResult = new ScanResult();
            strcpy(scanResult->ssid, ssid);
            scanResult->security = security;
        }
    }

    return scanResult;
}
Example #18
0
bool         TreeRow::SetData(
                    const int &_id,    const int &_idparent,const int &_SpRazd,    const int &_pp,
                    const int &_ppp,    const int &_ei,        const int &_state,    const int &_UserID,
                    const String &_Obd,        const String &_Obu,
                    const String &_Name,    const String &_SpRazdName,
                    const String &_format,    const String &_pos,        const String &_prim,
                    const String &_zona,        const String &_ppName,    const String &_eiName,
                    const String &_User,        const String &_CondName,    const String &_DetCreator,
                    const String &_DetUpdater,    const String &_RowCreator,
                    const String &_RowUpdater,    const double &_kol,
                    const bool &_arhive,    const bool &_CanChild,    const bool &_Accept,
                    const TDateTime  &_DetCreated,    const TDateTime  &_DetUpdated,
                    const TDateTime  &_RowCreated,    const TDateTime  &_RowUpdated
                    )
{
if (ItTrueClassName())
    {
    SetId(_id);// базовый класс
    SpRazd=_SpRazd;
    SetObd(_Obd);
    Name=_Name.Trim();
    SpRazdName=_SpRazdName.Trim();
    // текущий класс
    idparent=_idparent;
    pp=_pp;
    ppp=_ppp;
    ei=_ei;
    state=_state;
    UserID=_UserID;
    SetObu(_Obu);
    format=_format.Trim();
    pos=_pos.Trim();
    prim=_prim.Trim();
    zona=_zona.Trim();
    ppName=_ppName.Trim();
    eiName=_eiName.Trim();
    User=_User.Trim();
    CondName=_CondName.Trim();
    DetCreator=_DetCreator.Trim();
    DetUpdater=_DetUpdater.Trim();
    RowCreator=_RowCreator.Trim();
    RowUpdater=_RowUpdater.Trim();
    kol=_kol;
    Arhive=_arhive;
    Set_Force(false);
    CanChild=_CanChild;
    Accept=_Accept;
    DetCreated=_DetCreated;
    DetUpdated=_DetUpdated;
    RowCreated=_RowCreated;
    RowUpdated=_RowUpdated;    
    }
return CanUse();
}                    
Example #19
0
DWORD WINAPI _readOutputThread(LPVOID hPipeRead)
// Monitors handle for input. Exits when child exits or pipe breaks.
{
    String str, substr;
    int bsCount = 0;

    CHAR lpBuffer[128];
    DWORD nBytesRead;

    FORMACTION->logB("< --- " + _("Reading Output") + " - " + _("Please wait") + " --- >", 1);
    Application->ProcessMessages();

    while (1)
    {
//      if (_aborted) break;
        if ( !ReadFile(hPipeRead, lpBuffer, sizeof(lpBuffer), &nBytesRead, NULL) )
        {
            if (GetLastError() == ERROR_BROKEN_PIPE)
                break; // pipe done - normal exit path.
            else
            {
                FORMACTION->log(__FUNC__ ": Something bad happened, please report.");
                Application->ProcessMessages();
                break;
            }
        }

        str = str + AnsiString(lpBuffer, nBytesRead);
        str = ecc::ReplaceStr(str, "\r", "");

        // Eat "\b" and the character before "\b":
        int pos = str.Pos("\b");
        bool percCharFound = false;
        String perc = "";
        while (pos && (pos > 1))
        {
            ++bsCount;
            perc = str.SubString(pos - 1, 1) + perc; // Append char in reverse.
            if (bsCount == 4)
            {
                if (perc.Pos("%"))  // If the line is too long perc does not contain a '%'.
                {
                    percCharFound = true;
                    FORMACTION->lbl_ProfilePerc->Caption = perc.Trim();
                    FORMACTION->pb_Profile->Position = StrToIntDef(ecc::ReplaceStr(perc.Trim(), "%", ""), 0);
                    FORMACTION->updateAppTitlePerc();   //092b8
                    Application->ProcessMessages();
                }
                perc = "";
                bsCount = 0;
            }
            str.Delete(pos - 1, 2);
            pos = str.Pos("\b");
        }

        // Split lines:
        pos = str.Pos("\n");
        while (pos)
        {
            substr = str.SubString(1, pos - 1);
            bool suppressLog = false;       //093b1

            // If string starts with "Compressing" calculate and display progress percentage:
            if (substr.Pos("Compressing") == 1)
            {
                if (!PGlobals->LogFullAction)
                    suppressLog = true;     //093b1: Do not log succesful "Compressing..." messages.
                ++__compressingFileCount;
                float perc = ((float)__compressingFileCount / (float)FORMACTION->abtFileList->incFilesTotalCount) * 100;
                if (!percCharFound) { // Since 7z 4.19b the '%' character is not present in the captured output.
                    FORMACTION->lbl_ProfilePerc->Caption = IntToStr((int)perc) + "%";
                    FORMACTION->pb_Profile->Position = (int)perc;
                    FORMACTION->updateAppTitlePerc();   //092b8
                }
            }
            if (!suppressLog)                       //093b1
                FORMACTION->log(substr);            //093b1

            Application->ProcessMessages();
            str.Delete(1, pos);
            pos = str.Pos("\n");
        }
    }

    FORMACTION->logB("< --- " + _("Finished Reading Output") + " --- >", 1);
    Application->ProcessMessages();
    __threadIsRunning = false;
    return 1;
}
Example #20
0
bool HttpsClient::ProxyConnect()
{
	if(use_proxy) {
		int start_time = msecs();
		int end_time = msecs() + timeout_msecs;
		while(!socket.PeekWrite(1000)) {
			int time = msecs();
			if(time >= end_time) {
				error = NFormat(t_("%s:%d: connecting to host timed out"), socket_host, socket_port);
				Close();
				return false;
			}
		}
		String host_port = host;
		if(port)
			host_port << ':' << port;
		else
			host_port << ":443";
		String request;
		request << "CONNECT " << host_port << " HTTP/1.1\r\n"
		        << "Host: " << host_port << "\r\n";
		if(!IsNull(proxy_username))
			request << "Proxy-Authorization: Basic "
			        << Base64Encode(proxy_username + ':' + proxy_password) << "\r\n";
		request << "\r\n";
		LLOG(request);
		int written = 0;
		while(msecs() - end_time < 0) {
			int nwrite = socket.WriteWait(request.GetIter(written), min(request.GetLength() - written, 1000), 1000);
			if(socket.IsError()) {
				error = Socket::GetErrorText();
				Close();
				return false;
			}
			if((written += nwrite) >= request.GetLength())
				break;
		}
		if(written < request.GetLength()) {
			error = NFormat(t_("%s:%d: timed out sending request to server"), host, port);
			Close();
			return false;
		}
		String line = ReadUntilProgress('\n', start_time, end_time, false);
		LLOG("P< " << line);
		if(socket.IsError()) {
			error = Socket::GetErrorText();
			Close();
			return false;
		}
		if(!line.StartsWith("HTTP") || line.Find(" 2") < 0) {
			error = "Invalid proxy reply: " + line;
			Close();
			return false;
		}
		while(line.GetCount()) {
			line = ReadUntilProgress('\n', start_time, end_time, false);
			if(*line.Last() == '\r')
				line.Trim(line.GetCount() - 1);
			LLOG("P< " << line << " len " << line.GetCount());
			if(socket.IsError()) {
				error = Socket::GetErrorText();
				Close();
				return false;
			}
		}
		use_proxy = false;
		while(!socket.PeekWrite(1000)) {
			int time = msecs();
			if(time >= end_time) {
				error = NFormat(t_("%s:%d: connecting to host timed out"), socket_host, socket_port);
				Close();
				return false;
			}
		}
	}
	return true;
}
Example #21
0
void
FCarAddEdit::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if (actionId == ID_CANCEL){
		bool issaved = false;
		if (!this->detailmode) {
		if (CheckIfDataChanged()) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Confirm cancel", "Car data changed. Save data?", MSGBOX_STYLE_YESNO, 10000);
			msgbox.ShowAndWait(modalResult);
			if (modalResult == MSGBOX_RESULT_YES) {
				if (Save() == false) {
					return;
				} else {
					issaved = true;
				}
			}
		}
		}
		if (this->formtype == 2) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			if (issaved) {
				carconclass_->SetLastSelectedID(this->itemid);
				FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
			} else {
				ArrayList * list = new ArrayList;
				list->Construct();
				list->Add(*(new Integer(2)));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_SETTINGSFORM, list);
			}
		} else {
		if ((!this->detailform) || (this->detailmode)) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SAVE) {
		if (Save() == false) {
			return;
		}
		if (this->formtype == 2) {
		carconclass_->SetLastSelectedID(this->itemid);
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
		} else {
		if (!this->detailform) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPOK) {
		fueltypesselectedarray_.RemoveAll();
		int checkeditemindex;
		int fueltypeid;
		checkeditemindex = pListSelectFuelTypes_->GetFirstCheckedItemIndex();
		while (checkeditemindex > -1) {
			fueltypeid = pListSelectFuelTypes_->GetItemIdAt(checkeditemindex);
			fueltypesselectedarray_.Add(fueltypeid);
			checkeditemindex = pListSelectFuelTypes_->GetNextCheckedItemIndexAfter(checkeditemindex);
		}
		controlhandler_->SetValue(this,L"CB_4_fueltypestring", GetFuelTypesString());
		pPopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPCANCEL) {
		pAddnewfueltypepopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPSAVE) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		String tmps = pAddnewfueltypepopupEditField_->GetText();
		tmps.Trim();
		if (tmps == "") {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Empty value!", "Input fuel type caption!", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		} else {
			FuelTypeData fueltypedata_;
			fueltypedata_.Caption = tmps;
			fueltypedata_.ID = 0;
			carconclass_->SaveFuelTypeData(fueltypedata_);
			pListSelectFuelTypes_->AddItem(&fueltypedata_.Caption, null, null, null, fueltypedata_.ID);
			int selecteditemindex = pListSelectFuelTypes_->GetItemIndexFromItemId(fueltypedata_.ID);
			if (selecteditemindex > -1) {
				pListSelectFuelTypes_->SetItemChecked(selecteditemindex, true);
			}
			pListSelectFuelTypes_->ScrollToBottom();
			pAddnewfueltypepopup_->SetShowState(false);
			RequestRedraw(true);
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPADD) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		pAddnewfueltypepopupEditField_->SetText(L"");
		pAddnewfueltypepopup_->SetShowState(true);
		pAddnewfueltypepopup_->Show();
	} else if (actionId == ID_BUTTON_EDITFIELD_DONE) {
		int actiondone = controlhandler_->ActionDone(this, source);
		if ((actiondone == ControlHandler::ACTIONDONERESULT_HIDEKEYPAD) || (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX)) {
			ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
			vpScrollPanel->CloseOverlayWindow();
		}
		if (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX) {
			pPopup_->SetShowState(true);
			pPopup_->Show();
		}
	} else if (actionId == ID_BUTTON_EDITFIELD_CLOSE) {
		ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
		vpScrollPanel->CloseOverlayWindow();
	} else if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		this->SetFocus();
		if (actionId == ID_DETAIL) {
			ReloadSavedData();
		}
		this->detailmode = (actionId == ID_DETAIL);
		DetailEditMode();
		RequestRedraw(true);
	}
}