Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * SUSE.
17 : *
18 : * Portions created by the Initial Developer are Copyright (C) 2011 the
19 : * Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s): Muthu Subramanian <sumuthu@suse.com>
22 : *
23 : * Alternatively, the contents of this file may be used under the terms of
24 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 : * instead of those above.
28 : */
29 :
30 : #include <com/sun/star/beans/PropertyValue.hpp>
31 : #include <com/sun/star/beans/XPropertyAccess.hpp>
32 : #include <com/sun/star/frame/XFrame.hpp>
33 : #include <com/sun/star/frame/XModel.hpp>
34 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 :
36 : #include <stdio.h>
37 :
38 : #include "bluthsndapi.hxx"
39 :
40 0 : SfxBluetoothModel::SendMailResult SfxBluetoothModel::SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
41 : const rtl::OUString& rType )
42 : {
43 : SaveResult eSaveResult;
44 0 : SendMailResult eResult = SEND_MAIL_ERROR;
45 0 : rtl::OUString aFileName;
46 :
47 0 : eSaveResult = SaveDocumentAsFormat( rtl::OUString(), xFrame, rType, aFileName );
48 0 : if( eSaveResult == SAVE_SUCCESSFULL )
49 : {
50 0 : maAttachedDocuments.push_back( aFileName );
51 0 : return Send( xFrame );
52 : }
53 0 : else if( eSaveResult == SAVE_CANCELLED )
54 0 : eResult = SEND_MAIL_CANCELLED;
55 :
56 0 : return eResult;
57 : }
58 :
59 0 : SfxBluetoothModel::SendMailResult SfxBluetoothModel::Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& /*xFrame*/ )
60 : {
61 : char bthsend[300];
62 0 : SendMailResult eResult = SEND_MAIL_OK;
63 0 : rtl::OUString aFileName = maAttachedDocuments[0];
64 0 : snprintf(bthsend,300,"bluetooth-sendto %s",rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8).getStr() );
65 0 : if( !system( bthsend ) )
66 0 : eResult = SEND_MAIL_ERROR;
67 0 : return eResult;
68 : }
69 :
70 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|