Commit 6a202cd758340a4ddccb6313c649a562ca72d762
1 parent
9b4e1a6c
Exists in
master
and in
5 other branches
Trabalhando na extensão LibreOffice
Showing
2 changed files
with
34 additions
and
0 deletions
Show diff stats
src/oxt/actions.cxx
| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | 32 | #include "globals.hpp" |
| 33 | + #include <unistd.h> | |
| 33 | 34 | #include <string.h> |
| 34 | 35 | |
| 35 | 36 | /*---[ Implement ]-----------------------------------------------------------------------------------------*/ |
| ... | ... | @@ -78,3 +79,35 @@ |
| 78 | 79 | return cmpTextAt(row,col,text) == 0; |
| 79 | 80 | } |
| 80 | 81 | |
| 82 | +::sal_Int16 SAL_CALL pw3270::uno_impl::waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException) | |
| 83 | +{ | |
| 84 | + time_t end = time(0) + seconds; | |
| 85 | + | |
| 86 | + osl_yieldThread(); | |
| 87 | + | |
| 88 | + while(time(0) < end) | |
| 89 | + { | |
| 90 | + switch(hSession->get_state()) | |
| 91 | + { | |
| 92 | + case LIB3270_MESSAGE_NONE: | |
| 93 | + return 0; | |
| 94 | + | |
| 95 | + case LIB3270_MESSAGE_DISCONNECTED: | |
| 96 | + return ENOTCONN; | |
| 97 | + | |
| 98 | + case LIB3270_MESSAGE_MINUS: | |
| 99 | + case LIB3270_MESSAGE_PROTECTED: | |
| 100 | + case LIB3270_MESSAGE_NUMERIC: | |
| 101 | + case LIB3270_MESSAGE_OVERFLOW: | |
| 102 | + case LIB3270_MESSAGE_INHIBIT: | |
| 103 | + case LIB3270_MESSAGE_KYBDLOCK: | |
| 104 | + return EPROTO; | |
| 105 | + | |
| 106 | + | |
| 107 | + } | |
| 108 | + | |
| 109 | + sleep(1); | |
| 110 | + } | |
| 111 | + | |
| 112 | + return ETIMEDOUT; | |
| 113 | +} | ... | ... |
src/oxt/globals.hpp
| ... | ... | @@ -152,6 +152,7 @@ |
| 152 | 152 | virtual ::sal_Bool SAL_CALL isReady( ) throw (::com::sun::star::uno::RuntimeException); |
| 153 | 153 | virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException); |
| 154 | 154 | virtual ::sal_Bool SAL_CALL hasTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& text ) throw (::com::sun::star::uno::RuntimeException); |
| 155 | + virtual ::sal_Int16 SAL_CALL waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException); | |
| 155 | 156 | |
| 156 | 157 | private: |
| 157 | 158 | ... | ... |