Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #include <com/sun/star/beans/PropertyValue.hpp>
11 : #include <com/sun/star/beans/XPropertyAccess.hpp>
12 : #include <com/sun/star/frame/XFrame.hpp>
13 : #include <com/sun/star/frame/XModel.hpp>
14 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
15 :
16 : #include <stdio.h>
17 :
18 : #include "bluthsndapi.hxx"
19 :
20 0 : SfxBluetoothModel::SendMailResult SfxBluetoothModel::SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
21 : const OUString& rType )
22 : {
23 : SaveResult eSaveResult;
24 0 : SendMailResult eResult = SEND_MAIL_ERROR;
25 0 : OUString aFileName;
26 :
27 0 : eSaveResult = SaveDocumentAsFormat( OUString(), xFrame, rType, aFileName );
28 0 : if( eSaveResult == SAVE_SUCCESSFULL )
29 : {
30 0 : maAttachedDocuments.push_back( aFileName );
31 0 : return Send( xFrame );
32 : }
33 0 : else if( eSaveResult == SAVE_CANCELLED )
34 0 : eResult = SEND_MAIL_CANCELLED;
35 :
36 0 : return eResult;
37 : }
38 :
39 0 : SfxBluetoothModel::SendMailResult SfxBluetoothModel::Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& /*xFrame*/ )
40 : {
41 : char bthsend[300];
42 0 : SendMailResult eResult = SEND_MAIL_OK;
43 0 : OUString aFileName = maAttachedDocuments[0];
44 0 : snprintf(bthsend,300,"bluetooth-sendto %s",OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8).getStr() );
45 0 : if( !system( bthsend ) )
46 0 : eResult = SEND_MAIL_ERROR;
47 0 : return eResult;
48 : }
49 :
50 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|