1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
24 #include <unx/saldisp.hxx>
28 #include <QtCore/QHash>
29 #include <QtCore/QSocketNotifier>
30 #include <QtCore/QTimer>
32 #include <unx/salinst.h>
33 #include <osl/conditn.hxx>
35 class VCLKDEApplication
;
37 class KDEXLib
: public QObject
, public SalXLib
42 std::unique_ptr
<VCLKDEApplication
> m_pApplication
;
43 std::unique_ptr
<char*[]> m_pFreeCmdLineArgs
;
44 std::unique_ptr
<char*[]> m_pAppCmdLineArgs
;
45 int m_nFakeCmdLineArgs
;
52 QSocketNotifier
* notifier
;
54 QHash
< int, SocketData
> socketData
; // key is fd
56 bool m_isGlibEventLoopType
;
57 bool m_allowKdeDialogs
;
59 int m_postUserEventId
;
60 osl::Condition m_aWaitingYieldCond
;
63 void setupEventLoop();
66 void socketNotifierActivated( int fd
);
67 void timeoutActivated();
68 void startTimeoutTimer();
69 bool processYield( bool bWait
, bool bHandleAllCurrentEvents
);
72 void startTimeoutTimerSignal();
73 bool processYieldSignal( bool bWait
, bool bHandleAllCurrentEvents
);
74 css::uno::Reference
< css::ui::dialogs::XFilePicker2
>
75 createFilePickerSignal( const css::uno::Reference
< css::uno::XComponentContext
>& );
79 virtual ~KDEXLib() override
;
81 virtual void Init() override
;
82 virtual bool Yield( bool bWait
, bool bHandleAllCurrentEvents
) override
;
83 virtual void Insert( int fd
, void* data
, YieldFunc pending
, YieldFunc queued
, YieldFunc handle
) override
;
84 virtual void Remove( int fd
) override
;
85 virtual void StartTimer( sal_uLong nMS
) override
;
86 virtual void StopTimer() override
;
87 virtual bool CheckTimeout( bool bExecuteTimers
= true ) override
;
88 virtual void Wakeup() override
;
89 void TriggerUserEventProcessing();
92 bool allowKdeDialogs() { return m_allowKdeDialogs
; }
94 virtual void customEvent(QEvent
* e
) override
;
97 css::uno::Reference
< css::ui::dialogs::XFilePicker2
>
98 createFilePicker( const css::uno::Reference
< css::uno::XComponentContext
>& );
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */