LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sfx2 / source / dialog / bluthsnd.cxx
blob0083f074976851254fc452d8b94713fb382ad38b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #include <com/sun/star/frame/XFrame.hpp>
12 #include <stdio.h>
14 #include <bluthsndapi.hxx>
16 SfxBluetoothModel::SendMailResult SfxBluetoothModel::SaveAndSend( const css::uno::Reference< css::frame::XFrame >& xFrame )
18 SaveResult eSaveResult;
19 SendMailResult eResult = SEND_MAIL_ERROR;
20 OUString aFileName;
22 eSaveResult = SaveDocumentAsFormat( OUString(), xFrame, OUString(), aFileName );
23 if( eSaveResult == SAVE_SUCCESSFUL )
25 maAttachedDocuments.push_back( aFileName );
26 return Send();
28 else if( eSaveResult == SAVE_CANCELLED )
29 eResult = SEND_MAIL_CANCELLED;
31 return eResult;
34 SfxBluetoothModel::SendMailResult SfxBluetoothModel::Send()
36 #ifndef LINUX
37 (void) this; // avoid loplugin:staticmethods
38 return SEND_MAIL_ERROR;
39 #else
40 char bthsend[300];
41 SendMailResult eResult = SEND_MAIL_OK;
42 OUString aFileName = maAttachedDocuments[0];
43 snprintf(bthsend,300,"bluetooth-sendto %s",OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8).getStr() );
44 if( !system( bthsend ) )
45 eResult = SEND_MAIL_ERROR;
46 return eResult;
47 #endif
50 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */