⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 email_letterlist.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 2 页
字号:
      local l_23_2 = EmailGenerator:GetDataForItem(l_23_0)
      if l_23_2 ~= nil then
         l_23_2:ShowMessageInShell()
      end
      l_23_1.value = true
   end
end

HandleLetterBackgroundReleaseOutside = function(l_24_0, l_24_1)
   Objects3DHitFeedback:Release()
   l_24_1.value = true
end

HandleEmailSelected = function(l_25_0)
   local bt = l_25_0.Namespace:FindName("BodyText")  
   local data = EmailGenerator:GetDataForItem(l_25_0)
   if data ~= nil then
      local body = data:GetBody()
      if body ~= "" then      
         bt.String = body
      else
         bt.String = Locale:GetString("IDS_EMAIL_ISHTMLTEXT")
      end
   end
   bt._visible = true
end

HandleEmailDeselected = function(l_26_0)
   l_26_0.Namespace:FindName("BodyText")._visible = false
end

HandleMessageItemCreated = function(l_27_0, l_27_1)
   l_27_1.Opacity.value = 0
   l_27_1.OnSelected:connect(HandleEmailSelected)
   l_27_1.OnDeselected:connect(HandleEmailDeselected)
   local l_27_2 = l_27_1.Namespace:FindName("SenderText")
   local l_27_3 = l_27_1.Namespace:FindName("SubjectText")
   local l_27_4 = l_27_1.Namespace:FindName("DateTimeText")
   local l_27_5 = l_27_1.Namespace:FindName("BodyText")
   l_27_5._visible = false
   local l_27_6 = l_27_1.Namespace:FindName("LetterBackground")
   if l_27_6 ~= nil then
      l_27_6.onPress:connect(HandleLetterBackgroundPress)
      l_27_6.onRelease:connect(HandleLetterBackgroundRelease)
      l_27_6.onReleaseOutside:connect(HandleLetterBackgroundReleaseOutside)
   end
   trace("Created...\n")
   if _config_os == "windowsmobile" then
      if l_27_2 ~= nil then
         l_27_2.String = l_27_0:GetSender()
         if l_27_2.String == "" then
            l_27_2.String = l_27_0:GetSenderAddress()
            if l_27_2.String == "" then
               l_27_2.String = Locale:GetString("IDS_UNKNOWN_SENDER")
            end
         end
      end
      if l_27_3 ~= nil then
         l_27_3.String = l_27_0:GetSubject()
      end
      if l_27_4 ~= nil then
         if l_27_0:GetTimeReceived().IsValid then
            local toloc = l_27_0:GetTimeReceived():ToLocal()
            if toloc:IsToday() then
               l_27_4.String = toloc:GetTimeString(TimeFormatOptions_Default)
            elseif toloc:IsYesterday() then
               l_27_4.String = Locale:GetString("IDS_YESTERDAY")
            elseif toloc:IsWithinLastWeek() then
               l_27_4.String = toloc:GetDateString(DateFormatOptions_UseDayOfWeek)
            else
               l_27_4.String = toloc:GetDateString(DateFormatOptions_UseShortDate)
            end          
         else
            l_27_4.String = Locale:GetString("IDS_UNKNOWN_TIME")
         end
      end      
  else
    if l_27_2 ~= nil then
       l_27_2.String = "Malcolm Ford"
    end
    if l_27_3 ~= nil then
       l_27_3.String = "RE: Mode9 information"
    end
    if l_27_4 ~= nil then
       l_27_4.String = "7:27 PM"
    end
  end
end

HandleMessageItemDestroyed = function(l_28_0)
   l_28_0.OnSelected:disconnect(HandleEmailSelected)
   l_28_0.OnDeselected:disconnect(HandleEmailDeselected)
   local l_28_1 = l_28_0.Namespace:FindName("LetterBackground")
   if l_28_1 ~= nil then
      l_28_1.onPress:disconnect(HandleLetterBackgroundPress)
      l_28_1.onRelease:disconnect(HandleLetterBackgroundRelease)
      l_28_1.onReleaseOutside:disconnect(HandleLetterBackgroundReleaseOutside)
   end
end

ProtectDoubleClick = function()
   trace("[Email.m9] : ProtectDoubleClick")
   _timer.OnElapsed:disconnect(ProtectDoubleClick)
   _timer = nil
end

HandleKeyDown = function(l_30_0, l_30_1, l_30_2)
   trace("HandleKeyDown\n" .. l_30_1.Code)
   if l_30_1.Code == KeyCode_SwipeUp then
     if EmailGenerator.SelectedIndex > 0 then
        EmailGenerator.SelectedIndex = EmailGenerator.SelectedIndex - 1
        l_30_2.value = true
     end
   elseif l_30_1.Code == KeyCode_SwipeDown then
     if EmailGenerator.SelectedIndex < EmailGenerator:GetCount() - 1 then
        EmailGenerator.SelectedIndex = EmailGenerator.SelectedIndex + 1
        l_30_2.value = true
     end
   elseif l_30_1.Code == KeyCode_Up then
     if AccountGenerator:GetCount() == 1 then
       if EmailGenerator.SelectedIndex > 0 then
         EmailGenerator.SelectedIndex = EmailGenerator.SelectedIndex - 1
         l_30_2.value = true
       end
     elseif AccountGenerator.SelectedIndex > 0 then
        AccountGenerator.SelectedIndex = AccountGenerator.SelectedIndex - 1
        l_30_2.value = true
     end
    elseif l_30_1.Code == KeyCode_Down then
      if AccountGenerator:GetCount() == 1 then
        if EmailGenerator.SelectedIndex < EmailGenerator:GetCount() - 1 then
          EmailGenerator.SelectedIndex = EmailGenerator.SelectedIndex + 1
          l_30_2.value = true
        end
      elseif AccountGenerator.SelectedIndex < AccountGenerator:GetCount() - 1 then
        AccountGenerator.SelectedIndex = AccountGenerator.SelectedIndex + 1
        l_30_2.value = true
      end
    elseif l_30_1.Code == KeyCode_Return then
        if EmailGenerator.SelectedIndex > -1 then
           local egd = EmailGenerator:GetData(EmailGenerator.SelectedIndex)
           if not _timer and egd ~= nil then
              egd:ShowMessageInShell()
              _timer = timer(1)
              _timer.OnElapsed:connect(ProtectDoubleClick)
           end
           l_30_2.value = true
        elseif AccountGenerator.SelectedIndex > 0 then
           Email_InboxSoftkeyCallback()
           l_30_2.value = true
        end
    end
end

Email_InboxSoftkeyCallback = function()
   if AccountGenerator.SelectedIndex >= 0 then
      local l_31_0 = AccountGenerator:GetData(AccountGenerator.SelectedIndex)
      if l_31_0 ~= nil then
         local l_31_1 = l_31_0:GetAccountName()
         if l_31_1 ~= nil then
            Shell_NavigateTo(ShellLocation_Email, l_31_1)
         end
      end
   end
end

OnDeleteDialogExit = function(l_32_0)
   l_32_0.OnExit:disconnect(OnDeleteDialogExit)
   trace("Dialog exit! - " .. l_32_0.Result.ExitType)
   if l_32_0.Result.ExitType == DialogExitType_OK then
      trace("Dialog OK!")
      if EmailDatabase ~= nil then
         EmailDatabase:DeleteStore()
         RebuildAccountList()
      end
   end
end

ShowDeleteConfirmDialog = function()
   local l_33_0 = URL("Manila://Confirmation.dialog")
   l_33_0.Parameters:AddParameter("Title", Locale:GetString("IDS_MAIL_CONFIRM_DELETE_TITLE"))
   l_33_0.Parameters:AddParameter("ContentString", Locale:GetString("IDS_MAIL_CONFIRM_DELETE"))
   local l_33_1 = _application.DialogManager:GetDialog(l_33_0)
   l_33_1.OnExit:connect(OnDeleteDialogExit)
   l_33_1:Show()
end

Email_MenuExitCallback = function(l_34_0)
   if l_34_0.Result.ExitType ~= DialogExitType_Cancel then
      local l_34_1 = AccountGenerator:GetData(AccountGenerator.SelectedIndex)
      if l_34_1 ~= nil then
         local l_34_2 = l_34_1:GetAccountName()
         trace("Selected: " .. l_34_0.Result.UserValue)
         if l_34_0.Result.UserValue == "New Email" then
           if l_34_2 ~= nil then
             Shell_ComposeMessage(l_34_2, "", "", "")
           end
          elseif l_34_0.Result.UserValue == "Reply" then
             trace("In Reply\n")
             if _config_os == "windowsmobile" then
                trace("In Reply 2\n")
                if EmailGenerator.SelectedIndex > -1 then
                     trace("In Reply 3\n")
                     local edata = EmailGenerator:GetData(EmailGenerator.SelectedIndex)
                     if l_34_2 ~= nil and edata ~= nil then
                        Shell_ComposeMessage(l_34_2, edata:GetSenderAddress(), "RE: " .. edata:GetSubject(), "")
                     end
                end
             end
           elseif l_34_0.Result.UserValue == "Reply All" then
             if _config_os == "windowsmobile" then
               if EmailGenerator.SelectedIndex > -1 then
                 local edata = EmailGenerator:GetData(EmailGenerator.SelectedIndex)
                 if l_34_2 ~= nil and edata ~= nil then
                   Shell_ComposeMessage(l_34_2, edata:GetSenderAddress(), "RE: " .. edata:GetSubject(), "")
                 end
               end 
             end
           elseif l_34_0.Result.UserValue == "Forward" then
             if _config_os == "windowsmobile" then
               if EmailGenerator.SelectedIndex > -1 then
                 local edata = EmailGenerator:GetData(EmailGenerator.SelectedIndex)                 
                 if l_34_2 ~= nil and edata ~= nil then
                   Shell_ComposeMessage(l_34_2, "", "FW: " .. edata:GetSubject(), edata:GetBody())
                 end
               end
             end
           elseif l_34_0.Result.UserValue == "Add account" then
             if _config_os == "windowsmobile" then
               local count = AccountGenerator.Collection:GetCount()
               if count < MaxEmailAccount then
                 Shell_NavigateTo(ShellLocation_EmailAddAccount)
               else
                 local url = URL("Manila://Confirmation.dialog")
                 url.Parameters:AddParameter("Title", Locale:GetString("IDS_EMAIL_WARMING_MESSAGES"))
                 url.Parameters:AddParameter("ContentString", Locale:GetString("IDS_EMAIL_OVERACCOUNT_MESSAGES"))
                 url.Parameters:AddParameter("Type", "OK")
                 local dlg = _application.DialogManager:GetDialog(url)
                 dlg:Show()
               end
             end
           elseif l_34_0.Result.UserValue == "Remove account" then
             if _config_os == "windowsmobile" then
               ShowDeleteConfirmDialog()
             end
           elseif l_34_0.Result.UserValue == "Show accounts" then
             if _config_os == "windowsmobile" then
               Shell_NavigateTo(ShellLocation_Email)
             end
           elseif l_34_0.Result.UserValue == "Send/Receive" then
             if _config_os == "windowsmobile" and EmailDatabase ~= nil then
               EmailDatabase:Synchronize()
             end
           end
         end
   else
     trace("Canceled Dialog")
   end
end

Email_MenuSoftkeyCallback = function()
   if EmailGenerator.SelectedIndex ~= -1 then
      DialogRequest = _application.DialogManager:GetDialog(URL("Manila://Email.dialog"))
      DialogRequest.OnExit:connect(Email_MenuExitCallback)
      DialogRequest:Show()
   else
      DialogRequest = _application.DialogManager:GetDialog(URL("Manila://EmailNoItems.dialog"))
      DialogRequest.OnExit:connect(Email_MenuExitCallback)
      DialogRequest:Show()
   end
end

Email_MenuAddAccountCallback = function()
   if _config_os == "windowsmobile" then
      Shell_NavigateTo(ShellLocation_EmailAddAccount)
   end
end

InitialEmailObject = function()
   trace("InitialEmailObject")
   local l_37_0 = PathLayout()
   EmailLayoutExtender = LetterLayout(l_37_0)
   l_37_0:SetItemSize(1, 1, 0)
   EmailList:SetLayout(l_37_0)
   EmailList.AllowScrollToEnd = true
   EmailGenerator = LibraryGeneratorMailMessage(nil, EmailList:GetMovie(), EmailList.ComponentLibraryName, EmailList.ComponentLibraryID)
   EmailGenerator.ItemsReplaced:connect(HandleAccountItemsReplaced)
   EmailGenerator.RecycleItems = true
   EmailGenerator.ForceImmediateCleanup = true
   EmailGenerator.ItemCreated:connect(HandleMessageItemCreated)
   EmailGenerator.ItemDestroyed:connect(HandleMessageItemDestroyed)
   EmailList:SetGenerator(EmailGenerator)
   trace("InitialEmailObject end")
end

trace("load Letter list script end")

⌨️ 快捷键说明

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