Tag: cws_src680_asyncdialogs2
User: liyuan  
Date: 2007/01/31 01:24:07

Modified:
   dba/dbaccess/source/ui/dlg/ConnectionHelper.cxx

Log:
 #caseid: 7, by liyuan

File Changes:

Directory: /dba/dbaccess/source/ui/dlg/
=======================================

File [changed]: ConnectionHelper.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/ConnectionHelper.cxx?r1=1.11&r2=1.11.48.1
Delta lines:  +49 -22
---------------------
--- ConnectionHelper.cxx        17 Sep 2006 07:04:35 -0000      1.11
+++ ConnectionHelper.cxx        31 Jan 2007 09:24:05 -0000      1.11.48.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ConnectionHelper.cxx,v $
  *
- *  $Revision: 1.11 $
+ *  $Revision: 1.11.48.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 07:04:35 $
+ *  last change: $Author: liyuan $ $Date: 2007/01/31 09:24:05 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -87,6 +87,9 @@
 #ifndef _SV_MSGBOX_HXX
 #include <vcl/msgbox.hxx>
 #endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
 #ifndef _FILEDLGHELPER_HXX 
 #include <sfx2/filedlghelper.hxx>
 #endif
@@ -203,6 +206,7 @@
         ,m_aFT_Connection(this, ResId(FT_AUTOBROWSEURL))
                ,m_aET_Connection(this, ResId(ET_AUTOBROWSEURL))
         ,m_aPB_Connection(this, ResId(PB_AUTOBROWSEURL))
+       ,m_pDlgHelper ( NULL )
     {
         DBG_CTOR(OConnectionHelper,NULL);
 
@@ -219,6 +223,10 @@
        {
        
         DBG_DTOR(OConnectionHelper,NULL);
+               if ( m_pDlgHelper )
+                {
+                        delete m_pDlgHelper;
+                }
     }
 
 
@@ -317,20 +325,22 @@
                        break;
                        case DST_CALC:
                        {
-                               ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | 
WB_STDMODAL | WB_OPEN
+                               if ( m_pDlgHelper == NULL )
+                                       m_pDlgHelper = new 
::sfx2::FileDialogHelper(WB_3DLOOK | WB_STDMODAL | WB_OPEN
                                                                                
                
,SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC)
                                                                                
                ,SFX_FILTER_IMPORT);
-                               askForFileName(aFileDlg);
+                               askForFileName( *m_pDlgHelper );
                        }
                        break;
                        case DST_MSACCESS:
                        {
                                ::rtl::OUString 
sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb"));
                                String sFilterName(ModuleRes 
(STR_MSACCESS_FILTERNAME));
-                               ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | 
WB_STDMODAL | WB_OPEN);           
-                               aFileDlg.AddFilter(sFilterName,sExt);
-                               aFileDlg.SetCurrentFilter(sFilterName);
-                               askForFileName(aFileDlg);
+                               if ( m_pDlgHelper == NULL )
+                                       m_pDlgHelper = new 
::sfx2::FileDialogHelper(WB_3DLOOK | WB_STDMODAL | WB_OPEN);
+                                m_pDlgHelper->AddFilter(sFilterName,sExt);
+                                m_pDlgHelper->SetCurrentFilter(sFilterName);
+                                askForFileName( *m_pDlgHelper );
                        }
                        break;
                        case DST_ADABAS:
@@ -988,6 +998,28 @@
                return sal_True;
        }    
     //-------------------------------------------------------------------------
+       IMPL_LINK(OConnectionHelper, DestroyDlgHdl, void*, EMPTYAG)    
+       {
+               if ( m_pDlgHelper )
+               {
+                       delete m_pDlgHelper;
+                       m_pDlgHelper = NULL;
+               }
+               return 0L;
+       }
+       
//-------------------------------------------------------------------------
+       IMPL_LINK( OConnectionHelper, DialogClosedHdl, 
::sfx2::FileDialogHelper*, pFdh )
+       {
+                if ( 0 == pFdh->GetError() )
+                {
+                        setURLNoPrefix(pFdh->GetPath());
+                        SetRoadmapStateValue(checkTestConnection());
+                        callModifiedHdl();
+                }
+               Application::PostUserEvent(LINK(this, OConnectionHelper, 
DestroyDlgHdl));
+                return 0L;
+       }
+       
//-------------------------------------------------------------------------
     void OConnectionHelper::askForFileName(::sfx2::FileDialogHelper& 
_aFileOpen)
        {
                String sOldPath = getURLNoPrefix();
@@ -995,12 +1027,7 @@
                        _aFileOpen.SetDisplayDirectory(sOldPath);
                else
                        _aFileOpen.SetDisplayDirectory( 
SvtPathOptions().GetWorkPath() );
-               if (0 == _aFileOpen.Execute())
-               {
-                   setURLNoPrefix(_aFileOpen.GetPath());
-            SetRoadmapStateValue(checkTestConnection());
-                       callModifiedHdl();
-               }
+               _aFileOpen.StartExecuteModal(LINK(this, OConnectionHelper, 
DialogClosedHdl));
        }
 
 //.........................................................................




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to