void __fastcall TMainFrm::DeleteExecute(TObject *Sender) { if (lvHeaders->Selected !=NULL) { ShowBusy(true); lvHeaders->Selected->ImageIndex = 3; ShowBusy(false); } }
void __fastcall TMainFrm::CheckMailExecute(TObject *Sender) { ShowBusy(true); ShowStatus("Connecting...."); if (POP->Connected()) { POP->Disconnect(); } POP->Host = Pop3ServerName; POP->Port = Pop3ServerPort; POP->UserId = Pop3ServerUser; POP->Password = Pop3ServerPassword; Application->ProcessMessages(); Application->ProcessMessages(); Application->ProcessMessages(); POP->Connect(); ToggleStatus(true,true); FMsgCount = POP->CheckMessages(); FMailBoxSize = POP->RetrieveMailBoxSize()/1024; ShowFileStatus(); if (FMsgCount > 0) { ShowFileStatus(); RetrievePOPHeaders(FMsgCount); } else { ShowStatus("No messages on server"); } if (POP->Connected()) { POP->Disconnect(); } ToggleStatus(false,true); ShowBusy(false); }
void __fastcall TMainFrm::FormCreate(TObject *Sender) { IndyVersionLabel->Caption=POP->Version; ReadConfiguration(); //setup path to put attachments into FAttachPath = IncludeTrailingBackslash(ExtractFileDir(ParamStr(0))); //starting directory FAttachPath = FAttachPath + "Attach\\"; if (!DirectoryExists(FAttachPath)) ForceDirectories(FAttachPath); FMsgCount = 0; FMailBoxSize = 0; ShowBusy(false); }
bool Piano::MouseEvent( wxMouseEvent& event ) { int x, y; event.GetPosition( &x, &y ); if(event.Leaving() || y < cc1->GetCanvasHeight() - GetHeight()) { if(m_bleaving) return false; m_bleaving = true; } else m_bleaving = false; // Check the regions int sel_index = -1; int sel_dbindex = -1; for( int i = 0; i < m_nRegions; i++ ) { if( KeyRect.Item( i ).Contains( x, 6 ) ) { sel_index = i; sel_dbindex = m_key_array.Item( i ); break; } } if(g_btouch){ if( event.LeftDown() ) { if( -1 != sel_index ){ m_action = DEFERRED_KEY_CLICK_DOWN; ShowBusy( true ); #ifdef __OCPN__ANDROID__ androidShowBusyIcon(); #endif m_eventTimer.Start(10, wxTIMER_ONE_SHOT); } } if( event.LeftUp() ) { if( -1 != sel_index ){ m_click_sel_index = sel_index; m_click_sel_dbindex = sel_dbindex; if(!m_eventTimer.IsRunning()){ m_action = DEFERRED_KEY_CLICK_UP; m_eventTimer.Start(10, wxTIMER_ONE_SHOT); } } } else if( event.RightDown() ) { if( sel_index != m_hover_last ) { gFrame->HandlePianoRollover( sel_index, sel_dbindex ); m_hover_last = sel_index; // m_action = INFOWIN_TIMEOUT; // m_eventTimer.Start(3000, wxTIMER_ONE_SHOT); } } else if( event.ButtonUp() ) { gFrame->HandlePianoRollover( -1, -1 ); ResetRollover(); } } else{ if( m_bleaving ) { gFrame->HandlePianoRollover( -1, -1 ); ResetRollover(); } else if( event.LeftDown() ) { if( -1 != sel_index ) { gFrame->HandlePianoClick( sel_index, sel_dbindex ); gFrame->Raise(); } else return false; } else if( event.RightDown() ) { if( -1 != sel_index ) { gFrame->HandlePianoRClick( x, y, sel_index, sel_dbindex ); gFrame->Raise(); } else return false; } else if(!event.ButtonUp()){ if( sel_index != m_hover_last ) { gFrame->HandlePianoRollover( sel_index, sel_dbindex ); m_hover_last = sel_index; } } } return true; /* Todo: Could do something like this to better encapsulate the pianowin Allows us to get rid of global statics... wxCommandEvent ev(MyPianoEvent); // Private event ..set up event to specify action...SelectChart, SetChartThumbnail, etc ::PostEvent(pEventReceiver, ev); // event receiver passed to ctor */ }
void __fastcall TMainFrm::RetrieveExecute(TObject *Sender) { if (!POP->Connected()) { POP->Connect(); } AnsiString LocalAttachmentfilename; AnsiString RecievedAttachmentfilename; AnsiString stTemp; int intIndex; TListItem *li; stTemp = StatusBar1->Panels->Items[1]->Text; if (lvHeaders->Selected ==NULL) return; //initialise ShowBusy(true); Msg->Clear(); Memo1->Clear(); lvMessageParts->Items->Clear(); From->Caption = ""; Cc->Caption = ""; Subject->Caption = ""; Date->Caption = ""; Receipt->Caption = ""; Organization->Caption = ""; Priority->Caption = ""; pnlAttachments->Visible = false; //get message and put into MSG ShowStatus("Retrieving message " + lvHeaders->Selected->SubItems->Strings[3] ); int msgnum=lvHeaders->Selected->Index + 1; POP->Retrieve(msgnum, Msg); StatusBar1->Panels->Items[0]->Text = lvHeaders->Selected->SubItems->Strings[3]; //Setup fields on screen from MSG From->Caption = Msg->From->Text; Recipients->Caption = Msg->Recipients->EMailAddresses; Cc->Caption = Msg->CCList->EMailAddresses; Subject->Caption = Msg->Subject; Date->Caption = FormatDateTime("dd mmm yyyy hh:mm:ss", Msg->Date); Receipt->Caption = Msg->ReceiptRecipient->Text; Organization->Caption = Msg->Organization; Priority->Caption = IntToStr((unsigned char)Msg->Priority + 1); //Setup attachments list ShowStatus("Decoding attachments (" + IntToStr(Msg->MessageParts->Count) + ")"); Memo1->Lines->Clear(); for (intIndex = 0; intIndex < (Msg->MessageParts->Count) ;intIndex++) { if (dynamic_cast<TIdAttachment*>(Msg->MessageParts->Items[intIndex])) { //general attachment pnlAttachments->Visible = true; li = lvMessageParts->Items->Add(); li->ImageIndex = 8; RecievedAttachmentfilename= dynamic_cast<TIdAttachment*>(Msg->MessageParts->Items[intIndex])->FileName; TIdAttachment*e=dynamic_cast<TIdAttachment*>(Msg->MessageParts->Items[intIndex]); LocalAttachmentfilename=ExtractFilePath(ParamStr(0)); LocalAttachmentfilename=LocalAttachmentfilename + "ATTACH\\";//add attach folder name to store locally in sub folder LocalAttachmentfilename=LocalAttachmentfilename + RecievedAttachmentfilename; li->Caption=LocalAttachmentfilename; if (e!=NULL) e->SaveToFile(LocalAttachmentfilename); } else {//body text if (dynamic_cast<TIdText*>(Msg->MessageParts->Items[intIndex] ))// then { Memo1->Lines->AddStrings(dynamic_cast<TIdText*>(Msg->MessageParts->Items[intIndex])->Body); } } } ShowStatus(stTemp); if (POP->Connected()) { POP->Disconnect(); } ShowBusy(false); }
void __fastcall TMainFrm::Retrievecurrentmessage1Click(TObject *Sender) { AnsiString stTemp; int intIndex; TListItem *li; stTemp = StatusBar1->Panels->Items[1]->Text; if (lvHeaders->Selected ==NULL) return; //initialise ShowBusy(true); Msg->Clear(); Memo1->Clear(); lvMessageParts->Items->Clear(); From->Caption = ""; Cc->Caption = ""; Subject->Caption = ""; Date->Caption = ""; Receipt->Caption = ""; Organization->Caption = ""; Priority->Caption = ""; pnlAttachments->Visible = false; //get message and put into MSG ShowStatus("Retrieving message " + lvHeaders->Selected->SubItems->Strings[3] ); POP->Retrieve(lvHeaders->Selected->Index + 1, Msg); StatusBar1->Panels->Items[0]->Text = lvHeaders->Selected->SubItems->Strings[3]; //Setup fields on screen from MSG From->Caption = Msg->From->Text; Recipients->Caption = Msg->Recipients->EMailAddresses; Cc->Caption = Msg->CCList->EMailAddresses; Subject->Caption = Msg->Subject; Date->Caption = FormatDateTime("dd mmm yyyy hh:mm:ss", Msg->Date); Receipt->Caption = Msg->ReceiptRecipient->Text; Organization->Caption = Msg->Organization; Priority->Caption = IntToStr((unsigned char)Msg->Priority + 1); // Priority->Caption = IntToStr(Ord(Msg.Priority) + 1); //Setup attachments list ShowStatus("Decoding attachments (" + IntToStr(Msg->MessageParts->Count) + ")"); // for (intIndex = 0; intIndex<= pred(Msg->MessageParts->Count) ;intIndex++) for (intIndex = 0; intIndex < (Msg->MessageParts->Count) ;intIndex++) { if (dynamic_cast<TIdAttachment*>(Msg->MessageParts->Items[intIndex])) { //general attachment pnlAttachments->Visible = true; li = lvMessageParts->Items->Add(); li->ImageIndex = 8; li->Caption = ExtractFilePath(ParamStr(0)) + dynamic_cast<TIdAttachment*>(Msg->MessageParts->Items[intIndex])->FileName; } else {//body text if (dynamic_cast<TIdText*>(Msg->MessageParts->Items[intIndex] )) { Memo1->Lines->Clear(); Memo1->Lines->AddStrings(dynamic_cast<TIdText*>(Msg->MessageParts->Items[intIndex])->Body); } } } ShowStatus(stTemp); ShowBusy(false); }