[haiku-commits] haiku: hrev51381 - src/apps/serialconnect

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 26 Aug 2017 17:22:12 +0200 (CEST)

hrev51381 adds 1 changeset to branch 'master'
old head: f1af46a2c041ce6b4af24fd2c9cfce26dbab1bef
new head: 83776950cdb8c4852c3b924309d9ea0b59916f30
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=83776950cdb8+%5Ef1af46a2c041

----------------------------------------------------------------------------

83776950cdb8: SerialConnect: fix mixup of file panels
  
  - Use separate file panels for "load" and "save" directions
  - Change the message sent by the "load" panel according to the protocol
    to use (it just forwards the one from the BMenuItem used to invoke it,
    which already has the protocol information).

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev51381
Commit:      83776950cdb8c4852c3b924309d9ea0b59916f30
URL:         http://cgit.haiku-os.org/haiku/commit/?id=83776950cdb8
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sat Aug 26 15:20:50 2017 UTC

----------------------------------------------------------------------------

2 files changed, 15 insertions(+), 3 deletions(-)
src/apps/serialconnect/SerialWindow.cpp | 17 ++++++++++++++---
src/apps/serialconnect/SerialWindow.h   |  1 +

----------------------------------------------------------------------------

diff --git a/src/apps/serialconnect/SerialWindow.cpp 
b/src/apps/serialconnect/SerialWindow.cpp
index 4524fa1..6890c69 100644
--- a/src/apps/serialconnect/SerialWindow.cpp
+++ b/src/apps/serialconnect/SerialWindow.cpp
@@ -42,6 +42,7 @@ SerialWindow::SerialWindow()
        : BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle,
                B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE | 
B_AUTO_UPDATE_SIZE_LIMITS)
        , fLogFilePanel(NULL)
+       , fSendFilePanel(NULL)
 {
        BMenuBar* menuBar = new BMenuBar(Bounds(), "menuBar");
        menuBar->ResizeToPreferred();
@@ -249,6 +250,7 @@ SerialWindow::SerialWindow()
 SerialWindow::~SerialWindow()
 {
        delete fLogFilePanel;
+       delete fSendFilePanel;
 }
 
 
@@ -325,18 +327,27 @@ void SerialWindow::MessageReceived(BMessage* message)
                        return;
                }
                case kMsgLogfile:
-               case kMsgSendFile:
                {
                        // Let's lazy init the file panel
                        if (fLogFilePanel == NULL) {
-                               fLogFilePanel = new BFilePanel(
-                                       message->what == kMsgSendFile ? 
B_OPEN_PANEL : B_SAVE_PANEL,
+                               fLogFilePanel = new BFilePanel(B_SAVE_PANEL,
                                        &be_app_messenger, NULL, B_FILE_NODE, 
false);
                                fLogFilePanel->SetMessage(message);
                        }
                        fLogFilePanel->Show();
                        return;
                }
+               case kMsgSendFile:
+               {
+                       // Let's lazy init the file panel
+                       if (fSendFilePanel == NULL) {
+                               fSendFilePanel = new BFilePanel(B_OPEN_PANEL,
+                                       &be_app_messenger, NULL, B_FILE_NODE, 
false);
+                       }
+                       fSendFilePanel->SetMessage(message);
+                       fSendFilePanel->Show();
+                       return;
+               }
                case kMsgSettings:
                {
                        int32 baudrate;
diff --git a/src/apps/serialconnect/SerialWindow.h 
b/src/apps/serialconnect/SerialWindow.h
index 7853e77..0157975 100644
--- a/src/apps/serialconnect/SerialWindow.h
+++ b/src/apps/serialconnect/SerialWindow.h
@@ -35,6 +35,7 @@ class SerialWindow: public BWindow
                                                BMenu*                  
fLineTerminatorMenu;
                                                BMenu*                  
fFileMenu;
                                                BFilePanel*             
fLogFilePanel;
+                                               BFilePanel*             
fSendFilePanel;
                                                BStatusBar*             
fStatusBar;
 
                static const    int                             kBaudrates[];


Other related posts:

  • » [haiku-commits] haiku: hrev51381 - src/apps/serialconnect - pulkomandy