Tag: cws_src680_dba24d User: fs Date: 2007-11-12 16:14:59+0000 Modified: dba/dbaccess/source/ui/uno/copytablewizard.cxx
Log: #i81658# use an InteractionHandler for asking the user whether to continue copying File Changes: Directory: /dba/dbaccess/source/ui/uno/ ======================================= File [changed]: copytablewizard.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/uno/copytablewizard.cxx?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +44 -18 --------------------- --- copytablewizard.cxx 2007-11-12 12:14:45+0000 1.1.2.3 +++ copytablewizard.cxx 2007-11-12 16:14:57+0000 1.1.2.4 @@ -4,9 +4,9 @@ * * $RCSfile: copytablewizard.cxx,v $ * - * $Revision: 1.1.2.3 $ + * $Revision: 1.1.2.4 $ * - * last change: $Author: fs $ $Date: 2007/11/12 12:14:45 $ + * last change: $Author: fs $ $Date: 2007/11/12 16:14:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -64,9 +64,11 @@ #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbcx/XRowLocate.hpp> #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdb/SQLContext.hpp> /** === end UNO includes === **/ #include <comphelper/componentcontext.hxx> +#include <comphelper/interaction.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/proparrhlp.hxx> #include <connectivity/dbexception.hxx> @@ -131,6 +133,7 @@ using ::com::sun::star::sdbc::XResultSetMetaDataSupplier; using ::com::sun::star::sdbc::XResultSetMetaData; using ::com::sun::star::sdbc::SQLException; + using ::com::sun::star::sdb::SQLContext; /** === end UNO using === **/ namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation; namespace CopyTableContinuation = ::com::sun::star::sdb::application::CopyTableContinuation; @@ -907,23 +910,46 @@ // no listener felt responsible for the error, or a listener told to ask the user - // TODO: interaction handler - String sAskIfContinue = String( ModuleRes( STR_ERROR_OCCURED_WHILE_COPYING ) ); - String sTitle = String( ModuleRes( STR_STAT_WARNING ) ); + try + { + SQLContext aError; + aError.Context = *this; + aError.Message = String( ModuleRes( STR_ERROR_OCCURED_WHILE_COPYING ) ); ::dbtools::SQLExceptionInfo aInfo( _rEvent.Error ); - OSQLMessageBox aDlg( - impl_getDialog_throw().GetParent(), - sTitle, - sAskIfContinue, - WB_YES_NO | WB_DEF_YES, - OSQLMessageBox::Warning, - aInfo.isValid() ? &aInfo : NULL - ); + if ( aInfo.isValid() ) + aError.NextException = _rEvent.Error; + else + { + // a non-SQL exception happend + Exception aException; + OSL_VERIFY( _rEvent.Error >>= aException ); + SQLContext aContext; + aContext.Context = aException.Context; + aContext.Message = aException.Message; + aContext.Details = _rEvent.Error.getValueTypeName(); + aError.NextException <<= aContext; + } - if ( aDlg.Execute() == RET_YES ) + ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) ); + + ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove; + xRequest->addContinuation( xYes.get() ); + xRequest->addContinuation( new ::comphelper::OInteractionDisapprove ); + + Reference< XInteractionHandler > xHandler( + m_aContext.createComponent( "com.sun.star.sdb.InteractionHandler" ), UNO_QUERY_THROW ); + // TODO: consistent concept for the interaction handler to use + xHandler->handle( xRequest.get() ); + + if ( xYes->wasSelected() ) // continue copying return true; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } // cancel copying return false; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
