xmlfavorites.luac.lua

来自「htc manila 2 sourcecode」· LUA 代码 · 共 163 行

LUA
163
字号
-- Decompiled using luadec 0.7 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;;;;;;;0,2;0,0,20;0,0,6,27,28,29;0,0,6,27,28,29;0,0,6;0,0,6,13; 2b98a4de_manila.luac 

require("basefavorites")
OperaSettingsPath = "\\application data\\opera\\"
OperaFavoritesFilePath = OperaSettingsPath .. "opera6.adr"
OperaThumbnailsPath = OperaSettingsPath .. "fthumbs\\"
if _config_os ~= "windowsmobile" then
   OperaThumbnailsPath = "c:\\temp\\"
end
trace("Xml Favorites Loaded\n")
CreateFavorites = function(l_1_0)
   local l_1_1 = nil
   if _config_os == "windowsmobile" then
      l_1_1 = SimpleCollectionXmlNode()
      local url = GetURLPath("HTC\\test.xml")
      local l_1_3 = XmlDocument_Create(url)
      l_1_3 = l_1_3:GetChild(nil)
      while l_1_3:IsValid() do
         trace("Added Child\n")
         l_1_1:AddItem(l_1_3)
         l_1_3 = l_1_3:GetNextSibling(nil)
      end
   else
      l_1_1 = VectorNotifyint()
      for i = 0, 15 do
         l_1_1:push_back(i)
      end
   end
  return XmlFavorites(l_1_0, l_1_1)
end

XmlFavorites = class(BaseFavorites)
XmlFavorites.__init = function(l_2_0, l_2_1, l_2_2)
   trace("XmlFavorites CTor\n")
   BaseFavorites.__init(l_2_0, l_2_1, l_2_2)
end

XmlFavorites.CreateGenerator = function(l_3_0, l_3_1, l_3_2, l_3_3)
   if _config_os == "windowsmobile" then
      trace("Creating Xml Node\n")
      l_3_0.generator = LibraryGeneratorXmlNode(l_3_0.collection, l_3_1, l_3_2, l_3_3)
   else
      l_3_0.generator = LibraryGeneratorint(l_3_0.collection, l_3_1, l_3_2, l_3_3)
   end
   return l_3_0.generator
end

XmlFavorites.SetupSoftKeys = function(l_4_0)
   _application:SetLeftSoftkey(Softkey("All Favorites", OnLeftSoftkey, l_4_0))
   _application:SetRightSoftkey(Softkey("Launch", OnRightSoftkey, l_4_0))
end

OnLeftSoftkey = function(l_5_0)
   l_5_0:OnAllFavoritesPressed()
end

OnRightSoftkey = function(l_6_0)
   l_6_0:OnLaunchPressed()
end

XmlFavorites.OnAllFavoritesPressed = function(l_7_0)
   trace("All favorites pressed.\n")
end

XmlFavorites.OnLaunchPressed = function(l_8_0)
   local l_8_1 = l_8_0.generator.SelectedIndex
   trace("Index: " .. l_8_1 .. "\n")
   if l_8_1 ~= nil and l_8_1 ~= -1 then
      if l_8_1 == 0 then
         Shell_NavigateTo(ShellLocation.Opera)
      else
         if l_8_1 - 1 < l_8_0.collection:GetCount() then
            Shell_NavigateTo(ShellLocation.Opera, l_8_0:GetDescription(l_8_0:GetFavorite(l_8_1 - 1)))
         end
      end
   end
end

XmlFavorites.GetFavorite = function(l_9_0, l_9_1)
   if _config_os == "windowsmobile" then
      if l_9_1 >= 0 and l_9_1 < l_9_0.collection:GetCount() then
         return l_9_0.collection:GetItem(l_9_1)
      else
         return nil
      end
   else
      local l_9_2 = {}
      l_9_2.Id = l_9_1
      if l_9_1 == 0 then
         l_9_2.Name = "BBC News Front Page"
         l_9_2.Url = "http://news.bbc.co.uk/"
      elseif l_9_1 == 1 then
         l_9_2.Name = "Digg / All News & Videos"
         l_9_2.Url = "http://www.digg.com"
      elseif l_9_1 == 2 then
         l_9_2.Name = "www.htc.com"
         l_9_2.Url = "http://www.htc.com"
      else
         l_9_2.Name = ""
         l_9_2.Url = ""
      end
      return l_9_2
   end
end

XmlFavorites.GetImagePreviewPath = function(l_10_0, l_10_1)
   if _config_os == "windowsmobile" then
      local l_10_2 = l_10_1:GetAttributeAsString("id")
      if l_10_2:HasValue() then
         trace("id is " .. l_10_2:GetValue() .. "\n")
         return OperaThumbnailsPath .. "fav_tn_" .. l_10_2:GetValue() .. ".png"
      end         
   else
      return OperaThumbnailsPath .. "fav_tn_" .. l_10_1.Id .. ".png"
   end
   return ""
end

XmlFavorites.GetImagePath = function(l_11_0, l_11_1)
   if _config_os == "windowsmobile" then
      local l_11_2 = l_11_1:GetAttributeAsString("id")
      if l_11_2:HasValue() then
         trace("id is " .. l_11_2:GetValue() .. "\n")
         return OperaThumbnailsPath .. "fav_pv_" .. l_11_2:GetValue() .. ".jpg"
      end         
   else
      return OperaThumbnailsPath .. "fav_pv_" .. l_11_1.Id .. ".jpg"
   end
   return ""
end

XmlFavorites.GetName = function(l_12_0, l_12_1)
   if _config_os == "windowsmobile" then
      local l_12_2 = l_12_1:GetAttributeAsString("name")
      if l_12_2:HasValue() then
         trace("Name is: " .. l_12_2:GetValue() .. "\n")
         return l_12_2:GetValue()
      end
   else
      return l_12_1.Name
   end
   return ""
end

XmlFavorites.GetDescription = function(l_13_0, l_13_1)
   if _config_os == "windowsmobile" then
      local l_13_2 = l_13_1:GetChild("logo")
      if l_13_2:IsValid() then
         local l_13_3 = l_13_2:GetAttributeAsString("url")
         if l_13_3:HasValue() then
            trace("URL is: " .. l_13_3:GetValue() .. "\n")
            return l_13_3:GetValue()
         end
      end         
   else
     return l_13_1.Url
   end
   return ""
end


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?